xiaozhuai / imageinfo

Free Palestine🇵🇸🇵🇸🇵🇸Cross platform super fast single header c++ library to get image size and format without loading/decoding. Support avif, bmp, cur, dds, gif, hdr (pic), heic (heif), icns, ico, j2k, jp2, jpeg (jpg), jpx, ktx, png, psd, qoi, tga, tiff (tif), webp ...
MIT License
106 stars 26 forks source link

Fix msvc2019 winx64 compile issue #5

Closed omrdk closed 7 months ago

omrdk commented 7 months ago

Such a great lightweight header file to get basic image information for 20 different formats. I'd also look for a chance to get *.exr information but still good enough to get by. Tested on MacOS Ventura (M1 Chip arm64), Linux (x64), and Windows(x64) platforms. One issue that I've got so far is shown in the below picture which you may wanna consider: msvc2019_err Still, I'll provide a hot fix with this PR anyway. Have a good one!

xiaozhuai commented 7 months ago

Hello @omrdk , thanks for the PR! Have a good day!

I don't think this is the rignt fix for the problem, the key is that msvc has define min and max macro. We can define #define NOMINMAX to disable it. then it will compile.

~Could you please try the following patch?~ ~fix_msvc.patch~ ~Just download it and exec git apply /path/to/fix_msvc.patch.~

I've update this pr, no need to download above patch file. You can directly pull your branch to see whether it works or not.

omrdk commented 7 months ago

Hello @omrdk , thanks for the PR! Have a good day!

I don't think this is the rignt fix for the problem, the key is that msvc has define min and max macro. We can define #define NOMINMAX to disable it. then it will compile.

~Could you please try the following patch?~ ~fix_msvc.patch~ ~Just download it and exec git apply /path/to/fix_msvc.patch.~

I've update this pr, no need to download above patch file. You can directly pull your branch to see whether it works or not.

Well, disabling min and max macros didn't fix the compiling issue on my end, but changing the precedence seems to have more of an effect to prevent the conflict @xiaozhuai. Cheers!

xiaozhuai commented 7 months ago

Well, disabling min and max macros didn't fix the compiling issue on my end, but changing the precedence seems to have more of an effect to prevent the conflict @xiaozhuai. Cheers!

Well done! Thanks again for the pr. Merged.