fatal error: wx/setup.h: No such file or directory

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
marcusbarnet
Experienced Solver
Experienced Solver
Posts: 64
Joined: Sat Jul 27, 2019 3:45 pm

fatal error: wx/setup.h: No such file or directory

Post by marcusbarnet » Sun Jan 26, 2020 6:12 pm

I'm trying to setup the environment to use WxWidgets on Windows by using Codeblocks.
(I can successfully use WxWidgets in Ubuntu, but I do not use Microsoft Windows very often so I'm having hard time to correctly setup everything).

I followed this guide: https://wiki.wxwidgets.org/CodeBlocks_S ... ts_library and it seems the library has been correctly built.

If I try to build the "minimal" project under "sample" directory, I continue to get this error:

Code: Select all

In file included from .\..\..\include/wx/defs.h:45,
                 from .\..\..\include/wx/wxprec.h:12,
                 from C:\wxWidgets-3.1.3\samples\minimal\minimal.cpp:20:
.\..\..\include/wx/platform.h:154:10: fatal error: wx/setup.h: No such file or directory
I added this directory "C:\wxWidgets-3.1.3\include\" in "search directories", but I still continue to get the same error.

How can I solve it?

I built the library with this command:

Code: Select all

mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=1 BUILD=release UNICODE=1
I was getting error with UNICODE=0 and I changed it to 1 since I've read a topic on this forum that reported the same problem.

Thank you!

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 327
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: fatal error: wx/setup.h: No such file or directory

Post by New Pagodi » Sun Jan 26, 2020 7:03 pm

If you're using codeblocks, just use the wizard to create a new wxwidgets project. The wizard will configure all of the include/lib folders for you. You don't need to make any changes to your system's environment variables to use it.

marcusbarnet
Experienced Solver
Experienced Solver
Posts: 64
Joined: Sat Jul 27, 2019 3:45 pm

Re: fatal error: wx/setup.h: No such file or directory

Post by marcusbarnet » Sun Jan 26, 2020 7:19 pm

I already tried to use the wizard to create a new project, but I get always the same error!
During the wizard, it says me that "a matching debug configuration cannot be found in the Wxwidget directory you specified"
What does it mean?

I didn't have all these problems on Unix! windows is really crazy :D

User avatar
doublemax
Moderator
Moderator
Posts: 14640
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: fatal error: wx/setup.h: No such file or directory

Post by doublemax » Sun Jan 26, 2020 7:58 pm

That probably means that the configuration you selected in CB does not match the configuration you actually built.
viewtopic.php?p=169501&sid=8b310aedd398 ... 93#p169501

Did you see this guide? viewtopic.php?f=19&t=46125
Use the source, Luke!

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 327
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: fatal error: wx/setup.h: No such file or directory

Post by New Pagodi » Sun Jan 26, 2020 7:58 pm

You need to match the wizard's options to the settings you specified when building the library. Since you said you used the build command

Code: Select all

mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=1 BUILD=release UNICODE=1
make sure "Use wxWidgets dll" and "Enable Unicode" are checked and the option about a monolithic library is unchecked.
options.png
options.png (38.77 KiB) Viewed 257 times
Since you said you want to build the minimal wxWidgets sample, you need to take a few extra steps.
  1. First also check "Create empty project" (you would not ordinarily do this).
  2. When the wizard is finished, copy the code file "minimal.cpp" from the "<WXROOT>/samples/minimal/"to the project folder created by the wizard.
  3. Copy the resource file "sample.rc" and icon "sample.ico" from "<WXROOT>/samples/" to the project folder as well.
  4. Next, from the codeblocks menu, select "Project->Add files" and select the code and resource file you just moved.
Now the project should build and run normally.

marcusbarnet
Experienced Solver
Experienced Solver
Posts: 64
Joined: Sat Jul 27, 2019 3:45 pm

Re: fatal error: wx/setup.h: No such file or directory

Post by marcusbarnet » Sun Jan 26, 2020 9:18 pm

It seems to work now, thank you a lot!

Post Reply