3.1 compilation issue...

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
soundhound
Earned a small fee
Earned a small fee
Posts: 14
Joined: Tue Jun 19, 2018 1:05 pm

3.1 compilation issue...

Post by soundhound » Thu Jun 21, 2018 11:06 am

in the compilation of 3.1 under cygwin 2.7.2 on an XP box, I found that the msw/install.txt instructions talk about wx/msw/setup.h and setup0.h
it turns out these files are NOT influencing WXWIN_COMPATIBILITY_2_8 even though wx/platform.h is including wx/setup.h !

I only discovered this when I tried to compile an individual file of the distro after finding a needed symbol missing in a downstream package compilation:
g++ -DWXWIN_COMPATIBILITY_2_8=1 -c foo.cpp
which gave the original declaration as being in:
lib/wx/include/msw-unicode-3.1/setup.h // ...COMPAT_2_8 0
WTF?
and strangely, though the compilation says I 'redefined' the symbol, the object file was still missing the expected class definition.

so I made a test:
#ifdef XX
#error "foobar"
#endif

and tried
g++ -DXX (docs say set to 1)
g++ -DXX=0
g++ -DXX=1
and they ALL gave out the error!
I expected XX=0 not to.

and in the case of WXWIN_COMPATIBILITY_2_8 above, defining WXWIN_COMPATIBILITY_2_8=1 does NOT
override the original "#define WXWIN_COMPATIBILITY_2_8 0" despite the compiler indicating otherwise.
even using -UWXWIN_.... doesn't work!

am I losing my mind or is this a 'feature'?

User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: 3.1 compilation issue...

Post by eranon » Thu Jun 21, 2018 12:59 pm

Hello,

Are you sure you are testing the wxWigets libs you compiled? Don't you have several wxWidgets whose another one in the PATH for example?

Also, take care about the difference between #ifdef and #if: #ifdef indicates that the preprocessor definition is defined whatever its value, while #if will check for the value of the definition (with an implicit evaluation to zero when it's not defined at all). So, what if you remove -DXX in you command line? In this case, we're sure it's not defined and the error should not be raised.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]

soundhound
Earned a small fee
Earned a small fee
Posts: 14
Joined: Tue Jun 19, 2018 1:05 pm

Re: 3.1 compilation issue...

Post by soundhound » Thu Jul 19, 2018 12:38 am

thanks for clearing up that #if / #ifdef distinction for me - I can move on at last ! :P !

I have a working setup so never investigated the header files issue further :?

Post Reply