Header file problems
Posted: 2015-08-11T06:35:45-07:00
I downloaded Magick to try it on a minor image editing task I had (I was successful, and Magick appears to be very well done).
I am using VC 2015 and had to make some minor header changes to get a clean compile. As far as I can tell, all of these changes should be standard. I also had a problem when compiling in debug mode. Everything compiled cleanly, but I was unable to call Image::read() successfully. I traced it down to -MTd on the compile line. Changing that to -MT corrected the problem. Of course, that flag is needed for debugging. Anyway, on to the header changes. Its quite possible that a .dll compiled with -MD instead of -MDd using an older compiler like VC 2012 and linked to VC 2015 would be a problem in its own right.
1. In Magick++.h lines 10..15, #include <> was changed to #include "". The <> brackets are for system headers, which is not Magick headers.
2. In Magick++\Include.h, lines 42..43, #include <> was changed as above.
3. In magick\pixel-accessor.h, line 202 was changed from
intensity=0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue;
to
intensity=MagickRealType(0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue);
The constants 0.212656, 0.715158 and 0.072186 are type double which promotes the expression type to double which then causes a warning message about possible loss of data. The constants could have been replaced with "F" versions, but that could be a problem if MagickRealType is of type double instead of type float.
Thanks for the great product!
I am using VC 2015 and had to make some minor header changes to get a clean compile. As far as I can tell, all of these changes should be standard. I also had a problem when compiling in debug mode. Everything compiled cleanly, but I was unable to call Image::read() successfully. I traced it down to -MTd on the compile line. Changing that to -MT corrected the problem. Of course, that flag is needed for debugging. Anyway, on to the header changes. Its quite possible that a .dll compiled with -MD instead of -MDd using an older compiler like VC 2012 and linked to VC 2015 would be a problem in its own right.
1. In Magick++.h lines 10..15, #include <> was changed to #include "". The <> brackets are for system headers, which is not Magick headers.
2. In Magick++\Include.h, lines 42..43, #include <> was changed as above.
3. In magick\pixel-accessor.h, line 202 was changed from
intensity=0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue;
to
intensity=MagickRealType(0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue);
The constants 0.212656, 0.715158 and 0.072186 are type double which promotes the expression type to double which then causes a warning message about possible loss of data. The constants could have been replaced with "F" versions, but that could be a problem if MagickRealType is of type double instead of type float.
Thanks for the great product!