Author Topic: Porting a wxWidgets project from Linux to Windows  (Read 5947 times)

Offline konze

  • Single posting newcomer
  • *
  • Posts: 3
Porting a wxWidgets project from Linux to Windows
« on: July 06, 2011, 08:30:26 pm »
Hi,

I wrote a little wxWidgets program for a school project under Linux. But my school uses only Windows XP on their computers an my teacher wants that I compile the project under Windows XP. Unfortunately I get an error while I compile the program. Which preference should I set to compile a program (which is written under Linux) under Windows XP.

Best regards,

konze

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Porting a wxWidgets project from Linux to Windows
« Reply #1 on: July 06, 2011, 09:48:49 pm »
I suggest using the wizard to create a wxWidgets project, look how it is done there, or use it as stub for your linux project (after removing the cretaed files from th e project).

Offline konze

  • Single posting newcomer
  • *
  • Posts: 3
Re: Porting a wxWidgets project from Linux to Windows
« Reply #2 on: July 08, 2011, 01:14:18 pm »
The problem is I have the Code on my USB-stick and if I want to compile the Code I get the following error-message:

Code
||=== randGen, Debug ===|
||warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: created by a different GCC executable|
.\wx_pch.h|14|error: wx/wxprec.h: No such file or directory|
K:\randGen\randGenMain.cpp|10|warning: K:\randGen\wx_pch.h.gch/Debug_wx_pch_h_gch: created by a different GCC executable|
K:\randGen\randGenMain.h|14|error: wx/sizer.h: No such file or directory|
K:\randGen\randGenMain.h|15|error: wx/stattext.h: No such file or directory|
K:\randGen\randGenMain.h|16|error: wx/menu.h: No such file or directory|
K:\randGen\randGenMain.h|17|error: wx/textctrl.h: No such file or directory|
K:\randGen\randGenMain.h|18|error: wx/panel.h: No such file or directory|
K:\randGen\randGenMain.h|19|error: wx/button.h: No such file or directory|
K:\randGen\randGenMain.h|20|error: wx/frame.h: No such file or directory|
K:\randGen\randGenMain.h|21|error: wx/statusbr.h: No such file or directory|
K:\randGen\randGenMain.cpp|12|error: wx/msgdlg.h: No such file or directory|
K:\randGen\randGenMain.cpp|15|error: wx/settings.h: No such file or directory|
K:\randGen\randGenMain.cpp|16|error: wx/font.h: No such file or directory|
K:\randGen\randGenMain.cpp|17|error: wx/intl.h: No such file or directory|
K:\randGen\randGenMain.cpp|18|error: wx/string.h: No such file or directory|
K:\randGen\randGenMain.h|25|error: expected class-name before '{' token|
K:\randGen\randGenMain.h|28|error: expected ')' before '*' token|
K:\randGen\randGenMain.h|34|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|35|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|36|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|37|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|38|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|39|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|59|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|59|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|60|error: ISO C++ forbids declaration of 'wxStaticText' with no type|
K:\randGen\randGenMain.h|60|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|61|error: ISO C++ forbids declaration of 'wxStaticText' with no type|
K:\randGen\randGenMain.h|61|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|62|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|62|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|63|error: ISO C++ forbids declaration of 'wxStaticText' with no type|
K:\randGen\randGenMain.h|63|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|64|error: ISO C++ forbids declaration of 'wxStatusBar' with no type|
K:\randGen\randGenMain.h|64|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|65|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|65|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|66|error: ISO C++ forbids declaration of 'wxPanel' with no type|
K:\randGen\randGenMain.h|66|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|67|error: ISO C++ forbids declaration of 'wxTextCtrl' with no type|
K:\randGen\randGenMain.h|67|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|68|error: ISO C++ forbids declaration of 'wxTextCtrl' with no type|
K:\randGen\randGenMain.h|68|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|69|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|69|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|72|error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type|
K:\randGen\randGenMain.h|73|error: expected ';' before '}' token|
K:\randGen\randGenMain.h|73|error: expected ';' before '}' token|
K:\randGen\randGenMain.cpp|28|error: 'wxString' does not name a type|
K:\randGen\randGenMain.cpp|51|error: 'wxNewId' was not declared in this scope|
K:\randGen\randGenMain.cpp|52|error: 'wxNewId' was not declared in this scope|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 2 warnings ===|

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: Porting a wxWidgets project from Linux to Windows
« Reply #3 on: July 08, 2011, 01:24:58 pm »
The problem is I have the Code on my USB-stick and if I want to compile the Code I get the following error-message:

Code
||=== randGen, Debug ===|
||warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: created by a different GCC executable|
.\wx_pch.h|14|error: wx/wxprec.h: No such file or directory|
K:\randGen\randGenMain.cpp|10|warning: K:\randGen\wx_pch.h.gch/Debug_wx_pch_h_gch: created by a different GCC executable|
K:\randGen\randGenMain.h|14|error: wx/sizer.h: No such file or directory|
K:\randGen\randGenMain.h|15|error: wx/stattext.h: No such file or directory|
K:\randGen\randGenMain.h|16|error: wx/menu.h: No such file or directory|
K:\randGen\randGenMain.h|17|error: wx/textctrl.h: No such file or directory|
K:\randGen\randGenMain.h|18|error: wx/panel.h: No such file or directory|
K:\randGen\randGenMain.h|19|error: wx/button.h: No such file or directory|
K:\randGen\randGenMain.h|20|error: wx/frame.h: No such file or directory|
K:\randGen\randGenMain.h|21|error: wx/statusbr.h: No such file or directory|
K:\randGen\randGenMain.cpp|12|error: wx/msgdlg.h: No such file or directory|
K:\randGen\randGenMain.cpp|15|error: wx/settings.h: No such file or directory|
K:\randGen\randGenMain.cpp|16|error: wx/font.h: No such file or directory|
K:\randGen\randGenMain.cpp|17|error: wx/intl.h: No such file or directory|
K:\randGen\randGenMain.cpp|18|error: wx/string.h: No such file or directory|
K:\randGen\randGenMain.h|25|error: expected class-name before '{' token|
K:\randGen\randGenMain.h|28|error: expected ')' before '*' token|
K:\randGen\randGenMain.h|34|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|35|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|36|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|37|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|38|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|39|error: 'wxCommandEvent' has not been declared|
K:\randGen\randGenMain.h|59|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|59|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|60|error: ISO C++ forbids declaration of 'wxStaticText' with no type|
K:\randGen\randGenMain.h|60|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|61|error: ISO C++ forbids declaration of 'wxStaticText' with no type|
K:\randGen\randGenMain.h|61|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|62|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|62|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|63|error: ISO C++ forbids declaration of 'wxStaticText' with no type|
K:\randGen\randGenMain.h|63|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|64|error: ISO C++ forbids declaration of 'wxStatusBar' with no type|
K:\randGen\randGenMain.h|64|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|65|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|65|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|66|error: ISO C++ forbids declaration of 'wxPanel' with no type|
K:\randGen\randGenMain.h|66|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|67|error: ISO C++ forbids declaration of 'wxTextCtrl' with no type|
K:\randGen\randGenMain.h|67|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|68|error: ISO C++ forbids declaration of 'wxTextCtrl' with no type|
K:\randGen\randGenMain.h|68|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|69|error: ISO C++ forbids declaration of 'wxButton' with no type|
K:\randGen\randGenMain.h|69|error: expected ';' before '*' token|
K:\randGen\randGenMain.h|72|error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type|
K:\randGen\randGenMain.h|73|error: expected ';' before '}' token|
K:\randGen\randGenMain.h|73|error: expected ';' before '}' token|
K:\randGen\randGenMain.cpp|28|error: 'wxString' does not name a type|
K:\randGen\randGenMain.cpp|51|error: 'wxNewId' was not declared in this scope|
K:\randGen\randGenMain.cpp|52|error: 'wxNewId' was not declared in this scope|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 2 warnings ===|

You should add wx's header and lib search path to cb.
Regards,
xunxun

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Porting a wxWidgets project from Linux to Windows
« Reply #4 on: July 08, 2011, 01:25:37 pm »
You either need scripting or (much more easy) different targets for linux and windows.
In this case you can set the appropriate options for each platform and easily share the same project-file for both platforms.

Offline konze

  • Single posting newcomer
  • *
  • Posts: 3
Re: Porting a wxWidgets project from Linux to Windows
« Reply #5 on: July 08, 2011, 01:28:56 pm »
@xunxun1982

May you give me an example, because I'm new on this environment?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: Porting a wxWidgets project from Linux to Windows
« Reply #6 on: July 08, 2011, 03:07:52 pm »
@xunxun1982

May you give me an example, because I'm new on this environment?


"wxSmith - Aui" in the Code::Blocks Contrib Workspace SVN trunk.

Note: [Under 10.05 CB] You need to change the project properties "Build Targets" "Platforms" to all to see how if works under Windows.
Because you can NOT see the Linux "Build Options" if Windows is not allowed to run the target.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org