Moving a project to Windows 7

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
KZ
In need of some credit
In need of some credit
Posts: 1
Joined: Tue Apr 30, 2013 2:32 pm

Moving a project to Windows 7

Post by KZ »

Hello everyone

This is my first post here. I tried to find a solution to my problem but... I don't even know exactly where to search.

I have some code that compiles and works fine on my Windows Vista desktop with wxWidgets2.8.12 and Mingw Gcc 4.4. I want to make it work on my new Windows 7 desktop.
As I was changing computer, I had to reinstall everything (Code::Blocks, gcc, wxWidgets, SFML... all I worked with on my old computer). I decided to use newer tools and installed TDM-GCC 4.7.1 32bits.
I compiled the wxWidgets 2.8.12 library with the tdm gcc compiler with this code line :
mingw32-make.exe -f makefile.gcc BUILD=release MONOLITHIC=0 UNICODE=1 SHARED=0 USE_OPENGL=1 USE_ODBC=1 USE_QA=1
and then the same with BUILD=debug.

I also installed a toolchain to compile for 64bit Windows, but I didn't put it in my Path variable, and the errors occur while 32bit compiling.

My code doesn't use at all the Yield function, but it doesn't compile and I get the following errors:

Code: Select all

C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|error: macro "Yield" passed 1 arguments, but takes just 0|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|406|error: macro "Yield" passed 1 arguments, but takes just 0|
C:\Devlogs\wxWidgets-2.8.12\include\wx\msw\app.h|38|error: macro "Yield" passed 1 arguments, but takes just 0|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|error: 'Yield' declared as a 'virtual' field|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|error: expected ';' at end of member declaration|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|error: expected primary-expression before 'return'|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|error: expected '}' before 'return'|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|error: cannot convert '<brace-enclosed initializer list>' to 'bool' in initialization|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|230|error: expected ';' before 'return'|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|406|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]|
C:\Devlogs\wxWidgets-2.8.12\include\wx\app.h|406|error: 'Yield' declared as a 'virtual' field|
C:\Devlogs\wxWidgets-2.8.12\include\wx\msw\app.h|38|error: 'Yield' declared as a 'virtual' field|
||=== Build finished: 11 errors, 6 warnings (0 minutes, 1 seconds) ===|
I first installed Mingw GCC4.4 and I got the same errors.

Can somebody help me finding what I did wrong?

Thanks for reading me and sorry for my bad English...
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: Moving a project to Windows 7

Post by eranon »

Hello. Sounds like this thread : http://forums.wxwidgets.org/viewtopic.php?f=23&t=34225. So, maybe you should try to build a minimal sample from the wxWidgets ones first.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: Moving a project to Windows 7

Post by eranif »

The problem is that Windows already has Yield defined somewhere... but it is also a function in wxApp.

To avoid this error, change the include order:
Make sure that <wx/app.h> is included before any Windows' include files

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Moving a project to Windows 7

Post by stahta01 »

Make sure you never use the header windows.h in your code.

For the reason why read the technotes in wxWidgets.

docs/tech/tn0019.txt

You can replace the include of "windows.h" with "wx/msw/wrapwin.h"

Tim S.
Y_cant_i
In need of some credit
In need of some credit
Posts: 1
Joined: Tue Jun 10, 2014 7:06 pm

Re: Moving a project to Windows 7

Post by Y_cant_i »

Hi

Did you resolve this after? If so could you share your secret?

I'm not using wx within in an app just using its text functionality and I get the same problems.

Cheers
Post Reply