linux to windows compiling Topic is solved

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
guzzi_jones
Experienced Solver
Experienced Solver
Posts: 81
Joined: Sun Dec 08, 2013 3:50 am

linux to windows compiling

Post by guzzi_jones » Fri Apr 18, 2014 2:21 am

So i setup my initial program on linux with codeblocks, wxwidgets 2.8 , and libpqxx library.
Now i would like to compile the program on windows. I setup codeblocks, wxwidgets on windows.
I get "wx/app.h cannot find file or directory"

How do i set codeblocks on windows to find the wxwidgets libraries?

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2672
Joined: Sun Jan 03, 2010 5:45 pm

Re: linux to windows compiling

Post by PB » Fri Apr 18, 2014 5:50 am

This is how I did it, I do not use Code::Blocks (and GCC) as my primary IDE though.

It is expected that you have set the system environment variable WXWIN to the path with wxWidgets library, e.g. WXWIN=c:\dev\wxWidgets. If you used some kind of wxWidgets installer program, it may have done that for you. While it is not mandatory, it simplifies things somewhat. If you haven't done this I recommend you do or else you have to replace all the reference to WXWIN with the hard-coded path.

I assume you have successfully built the appropriate configurations of wxWidgets and all the required libraries are therefore in %WXWIN%\lib\gcc_lib (or %WXWIN%\lib\gcc_dll if you are linking against DLL).

For every build configuration (Debug, Release ...) go to Project/Build options and add $(WXWIN)\include to Search directories/Compiler. Then add a build specific folder, e.g. $(WXWIN)\lib\gcc_lib\mswud for static debug build, $(WXWIN)\lib\gcc_dll\mswu for shared release build and so on.

Similarly, you will need to add the library itself to the linker path, $(WXWIN)\lib\gcc_lib for static builds and $(WXWIN)\lib\gcc_dll for shared ones.

guzzi_jones
Experienced Solver
Experienced Solver
Posts: 81
Joined: Sun Dec 08, 2013 3:50 am

Re: linux to windows compiling

Post by guzzi_jones » Fri Apr 18, 2014 1:58 pm

PB wrote:This is how I did it, I do not use Code::Blocks (and GCC) as my primary IDE though.

It is expected that you have set the system environment variable WXWIN to the path with wxWidgets library, e.g. WXWIN=c:\dev\wxWidgets. If you used some kind of wxWidgets installer program, it may have done that for you. While it is not mandatory, it simplifies things somewhat. If you haven't done this I recommend you do or else you have to replace all the reference to WXWIN with the hard-coded path.

I assume you have successfully built the appropriate configurations of wxWidgets and all the required libraries are therefore in %WXWIN%\lib\gcc_lib (or %WXWIN%\lib\gcc_dll if you are linking against DLL).

For every build configuration (Debug, Release ...) go to Project/Build options and add $(WXWIN)\include to Search directories/Compiler. Then add a build specific folder, e.g. $(WXWIN)\lib\gcc_lib\mswud for static debug build, $(WXWIN)\lib\gcc_dll\mswu for shared release build and so on.

Similarly, you will need to add the library itself to the linker path, $(WXWIN)\lib\gcc_lib for static builds and $(WXWIN)\lib\gcc_dll for shared ones.
Thanks for the instructions. could you elaborate on adding the linker path ?
it clearly is not accepting my PATH variable WXWIN. I will try and restart. It finds the header files if i hard code the paths.
I attemted the instructions above but i am still getting:
C:\Users\ajonen\Documents\distdata\bdnApp.h|13|fatal error: wx/app.h: No such file or directory|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2672
Joined: Sun Jan 03, 2010 5:45 pm

Re: linux to windows compiling

Post by PB » Fri Apr 18, 2014 5:39 pm

AFAIC, the error message has nothing to do with linker.

Once again, have you added the build-specific folder to the include folders (e.g. $(WXWIN)\lib\gcc_lib\mswud for static Unicode debug build) besides the main wx include folder? Does that folder exist and does it actually contain a folder named wx which has file named setup.h? This file is produced when building a given wxWidgets library build. Have you successfully built the wxWidgets library and can you compile the bundled minimal samples using provided GCC makefile?

Also, I might have misunderstood you, but wxWidgets path doesn't go to %PATH%, you have to create a separate system environment variable named WXWIN. To verify it is there run a command prompt, type set, press <Enter> and check the variable is in the list and has correct value. Or just use hard-coded path instead of a variable. Should work just fine with just C:B.

guzzi_jones
Experienced Solver
Experienced Solver
Posts: 81
Joined: Sun Dec 08, 2013 3:50 am

Re: linux to windows compiling

Post by guzzi_jones » Sun Apr 20, 2014 3:12 am

Once I created wxwin variable it now sees the header files. Nowni am fighting with libpqxx.

Post Reply