Author Topic: wx/app.h: No such file or directory but app.h is in the included library  (Read 6066 times)

Offline marinoernestoch

  • Single posting newcomer
  • *
  • Posts: 8
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.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
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.

Offline marinoernestoch

  • Single posting newcomer
  • *
  • Posts: 8
Thanks Miguel for the help.
The wx global variable base field must contain C:\Program Files\wxWidgets-3.1.4,
 
I had already entered this definition.

and you must add $(#wx.include) to the compiler search directories.
 

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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
« Last Edit: August 16, 2020, 03:22:07 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline marinoernestoch

  • Single posting newcomer
  • *
  • Posts: 8
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.
« Last Edit: August 16, 2020, 04:30:38 pm by marinoernestoch »


Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
You must use:
   in Base: C:\Program Files\wxWidgets-3.1.4
   in Include: (blank)
   in Lib: (blank)

In Project Build Option Debug = $(#wx.lib)\gcc_lib\mswud
In Project Build Option Release = $(#wx.lib)\gcc_lib\mswu

This error

Code
gcc: error: Files\wxWidgets-3.1.4\lib\gcc_lib\mswud: No such file or directory

is because of the space in "Program Files", you must change wxWidgets' location to a folder without spaces in the absolute path (or local characters like Ñ).

Please use code tags when posting logs.
« Last Edit: August 16, 2020, 04:43:50 pm by Miguel Gimenez »

Offline marinoernestoch

  • Single posting newcomer
  • *
  • Posts: 8
Sorry Miguel for the code tags.

You must use:
   in Base: C:\Program Files\wxWidgets-3.1.4
   in Include: (blank)
   in Lib: (blank)

In Project Build Option Debug = $(#wx.lib)\gcc_lib\mswud
In Project Build Option Release = $(#wx.lib)\gcc_lib\mswu


After editing it does not find wx/setup.h which is in the library C:\Program Files\wxWidgets-3.1.4\include\wx\msw.

is because of the space in "Program Files", you must change wxWidgets' location to a folder without spaces in the absolute path (or local characters like Ñ).
So do I have to reinstall xwWidgets?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Quote
After editing it does not find wx/setup.h

The compilation of wxWidgets creates a copy of setup.h under $(#wx.lib)/gcc_lib/mswu/wx and other under $(#wx.lib)/gcc_lib/mswud/wx, that's why these paths must be in the Compiler Search Directories (without the last /wx part).

Quote
So do I have to reinstall xwWidgets?

No, just move the folder (for example to C:\Libraries\wxWidgets...) and change the wx global variable to reflect the new path.

Offline marinoernestoch

  • Single posting newcomer
  • *
  • Posts: 8
Good evening Miguel.
You've been of great help to me. :D
I made several tests.
Basically I only left $(#wx.include) in Global Compiler Settings both Search Directories Compiler and Resource Compiler. Instead in Project Build Option Debug and Project Build Option Release I left only $(#wx.lib)\gcc_lib\mswud and $(#wx.lib)\gcc_lib\mswu respectively.
(But I didn't understand the difference between  Compiler and Resouce compiler of Search directories in Global compiler setting).
With both C:\Program Files\wxWidgets-3.1.4 and C:\wxWidgets-3.1.4 I have overcome the problems I have found so far.

But now, for the modules defined in the debug link, I get: "" C:/Program Files/MinGW-w64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../ .. /../../x86_64-w64-mingw32/bin/ld.exe:skipping incompatibleC:\Program Files\ wxWidgets-3.1.4\lib\gcc_lib/libwxmsw31u.a when searching for -lwxmsw31u ""
Will it be a software level problem?
I know that Compiler / Linker errors are NOT Code :: Blocks errors.
But someone can direct me on the analysis of the problem.
Thank you

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wx/app.h: No such file or directory but app.h is in the included library
« Reply #10 on: August 16, 2020, 09:33:06 pm »
The incompatibility can be due to the use of different compilers, different compiler options or 64/32 bits mixing.

If you have downloaded precompiled wxWidgets you must use the same compiler they used.

EDIT: the problem with spaces is with the resource compiler
« Last Edit: August 16, 2020, 09:39:45 pm by Miguel Gimenez »

Offline marinoernestoch

  • Single posting newcomer
  • *
  • Posts: 8
Re: wx/app.h: No such file or directory but app.h is in the included library
« Reply #11 on: August 16, 2020, 09:57:45 pm »
Thank you.
Now I go back to the installations made of wxWidgets and MinGw but, by heart, following the installation steps of wxWidgets I followed the suggested links for the MinGw.
Thanks again.