qPCR4vir / nana-demo

demos and tests for Nana C++ GUI library
https://github.com/cnjinhao/nana
Boost Software License 1.0
68 stars 24 forks source link

Error in png.cpp #15

Open 5cript opened 5 years ago

5cript commented 5 years ago

Error in following example https://github.com/qPCR4vir/nana-demo/blob/master/Examples/png.cpp#L14 should be: #elif defined(NANA_ENABLE_JPEG)

qPCR4vir commented 5 years ago

Thank! Fixed, https://github.com/qPCR4vir/nana-demo/commits/cmake-dev and https://github.com/qPCR4vir/nana/commits/cmake-dev

but now I have tested jpeg... and have problems: a definition duplication of boolean in window.h vs jpeg @cnjinhao ??


In file included from C:/MinGW/include/jpeglib.h:31,
                 from C:\Prog\ExtLib\nana\source\paint\detail/image_jpeg.hpp:10,
                 from C:\Prog\ExtLib\nana\source\paint\image.cpp:28:

C:/MinGW/include/jmorecfg.h:242:13: 

error: conflicting declaration 'typedef int boolean'
 typedef int boolean;
             ^~~~~~~

             In file included from c:\mingw\x86_64-w64-mingw32\include\wtypes.h:8,
                 from c:\mingw\x86_64-w64-mingw32\include\winscard.h:10,
                 from c:\mingw\x86_64-w64-mingw32\include\windows.h:97,
                 from c:\prog\extlib\nana\source\detail\mswin/platform_spec.hpp:24,
                 from c:\prog\extlib\nana\source\detail\platform_spec_selector.hpp:18,
                 from C:\Prog\ExtLib\nana\source\paint\image.cpp:16:

c:\mingw\x86_64-w64-mingw32\include\rpcndr.h:65:25: 

note: previous declaration as 'typedef unsigned char boolean'
   typedef unsigned char boolean;
                         ^~~~~~~
cnjinhao commented 5 years ago

I just checked the jconfig.h coming with the nuwen's mingw distro, it is different with libjpeg-turbo and libjpeg. The libjpeg-turbo and libjpeg define boolean if __RPCNDR_H__ is not defined, so they work well with windows.h. The libjpeg in nuwen's mingw doesn't check if the boolean has been defined by standard headers. To solve the problem, base on comment at jmorecfg.h:235, adding -DHAVE_BOOLEAN seems to work fine.

qPCR4vir commented 5 years ago

hi!, yes, I tested that and compile, but i got a run-time error about the user expecting 600 b but jpeg expecting 633 b ??? because now boolean is char and not int ??

cnjinhao commented 5 years ago

The boolean in nuwen's libjpeg is int, but Windows.h, libjpeg and libjpeg-turbo provide boolean as unsigned char. I think the best solution is to let people avoid using the nuwen's libjpeg.