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?
linux to windows compiling Topic is solved
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: linux to windows compiling
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.
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.
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: linux to windows compiling
Thanks for the instructions. could you elaborate on adding the linker path ?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.
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) ===|
Re: linux to windows compiling
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.
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.
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: linux to windows compiling
Once I created wxwin variable it now sees the header files. Nowni am fighting with libpqxx.