User forums > Using Code::Blocks

wx/app.h: No such file or directory but app.h is in the included library

(1/3) > >>

marinoernestoch:
Hi.
I'm new and speak very little English.
I have a problem compiling wxWidgets. I think this forum is more correct, rather than a wxWidgets forum.
The problem is: although the library containing app.h (C:\Program Files\wxWidgets-3.1.4\include\wx\msw) is defined everywhere (- into project name, Project Build options Resource compiler - into project name, Debug Project Build options Compiler and into Resource compiler- into general resource compiler of compiler setting- into wx Global Variable Editor-) the c ++ compiler cannot find the module and reports the error "fatal error: wx / app.h: No such file or directory ").
These days I have installed CodeBlocks-17.12; wxWidgets-3.1.4 inserted in wxMSW-3.1.4; and tdm64-gcc-9.2.0.
For test I've tried Hello world and it's OK.
For test I defined a very small Windows Application project and tried to compile it.
Since then I've been banging my head to get out of the problem. I specify that I have not specified any compile-level options.
Who can help me understand where I went wrong.
I thank.

Miguel Gimenez:
The wx global variable base field must contain C:\Program Files\wxWidgets-3.1.4, and you must add $(#wx.include) to the compiler search directories.

For the linking stage you can add $(#wx.lib) to the linker search directories or use $(#wx.lib)/libwxmsw31u.a (for example) in the Link libraries control.

marinoernestoch:
Thanks Miguel for the help.

--- Quote from: Miguel Gimenez on August 15, 2020, 10:46:57 pm ---The wx global variable base field must contain C:\Program Files\wxWidgets-3.1.4,
 
--- End quote ---
I had already entered this definition.


--- Quote from: Miguel Gimenez on August 15, 2020, 10:46:57 pm ---and you must add $(#wx.include) to the compiler search directories.
 
--- End quote ---

I inserted this new definition but the result (read in the "Build Log") was that of having duplicated, in the list of libraries included by the compiler, the library (C:\Program Files\wxWidgets-3.1.4\include\wx\msw) containing app.h. The error remained. Anyway thanks.

stahta01:
Post the Build log!
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Tim S.

marinoernestoch:
This is the log:
////////////////////

-------------- Build: Debug in fine (compiler: GNU GCC Compiler)---------------

g++.exe -g -Wall -m32 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -I"C:\Program Files\wxWidgets-3.1.4\lib\gcc_lib\mswud" -I"C:\Program Files\wxWidgets-3.1.4\include\wx\msw" -c E:\Dati_Marino\A_AmbienteProva_NON_salvare\Code_Blocks_C++\fine\fineApp.cpp -o obj\Debug\fineApp.o
g++.exe -g -Wall -m32 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -I"C:\Program Files\wxWidgets-3.1.4\lib\gcc_lib\mswud" -I"C:\Program Files\wxWidgets-3.1.4\include\wx\msw" -c E:\Dati_Marino\A_AmbienteProva_NON_salvare\Code_Blocks_C++\fine\fineMain.cpp -o obj\Debug\fineMain.o
windres.exe -I"C:\Program Files\wxWidgets-3.1.4\lib\gcc_lib\mswud" -I"C:\Program Files\wxWidgets-3.1.4\include\wx\msw"  -J rc -O coff -i E:\DATI_M~1\A_AMBI~2\CODE_B~1\fine\resource.rc -o obj\Debug\resource.res
g++.exe -L"C:\Program Files\wxWidgets-3.1.4\lib\gcc_lib" -L"C:\Program Files\MinGW-w64\x86_64-w64-mingw32\lib" -L"C:\Program Files\MinGW-w64\lib" -L"C:\Program Files\MinGW-w64\x86_64-w64-mingw32\lib" -L"C:\Program Files\MinGW-w64\lib" -L"C:\Program Files\MinGW-w64\bin" -L"C:\Program Files\MinGW-w64\lib" -L"C:\Program Files\MinGW-w64\include" -o bin\Debug\fine.exe obj\Debug\fineApp.o obj\Debug\fineMain.o  obj\Debug\resource.res -m32 -mthreads  -lwxmsw31u -lwxpng -lwxjpeg -lwxtiff -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -loleacc -luxtheme -mwindows
In file included from E:\Dati_Marino\A_AmbienteProva_NON_salvare\Code_Blocks_C++\fine\fineApp.cpp:10:
E:\Dati_Marino\A_AmbienteProva_NON_salvare\Code_Blocks_C++\fine\fineApp.h:13:10: fatal error: wx/app.h: No such file or directory
   13 | #include <wx/app.h>
      |          ^~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 1 second(s))
 
In file included from E:\Dati_Marino\A_AmbienteProva_NON_salvare\Code_Blocks_C++\fine\fineMain.cpp:10:
E:\Dati_Marino\A_AmbienteProva_NON_salvare\Code_Blocks_C++\fine\fineMain.h:14:10: fatal error: wx/button.h: No such file or directory
   14 | #include <wx/button.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 1 second(s))
2 error(s), 0 warning(s) (0 minute(s), 1 second(s))
 
gcc: error: Files\wxWidgets-3.1.4\lib\gcc_lib\mswud: No such file or directory
gcc: error: Files\wxWidgets-3.1.4\include\wx\msw: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minute(s), 1 second(s))
5 error(s), 0 warning(s) (0 minute(s), 1 second(s))
 

//////////////////

Seeing that it duplicated all references to libraries I took away a lot.
The situation now is:
A)
* in Project Build Option Generic = $ (#wx.include);

* in Project Build Option Debug = C:\Program Files\wxWidgets-3.1.4\lib\gcc_lib\mswud;

* in Project Build Option Release = C:\Program Files\wxWidgets-3.1.4\lib\gcc_lib\mswu;
this in both Search Directories Compiler and Resource Compiler.

B) In Global Compiler Settings both Search Directories Compiler and Resource Compiler are blank.
C) In Global Variable Editor Current Variable wx =

* in Base: C: \ Program Files \ wxWidgets-3.1.4;
* in Include: C: \ Program Files \ wxWidgets-3.1.4 \ include \ wx \ msw.
The required modules are in the library underlined in the log above.
I don't know if I did well but the mistake is the same.
Thank you Stahta01.

Navigation

[0] Message Index

[#] Next page

Go to full version