fatal error: wx/setup.h: No such file 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
Nico
Knows some wx things
Knows some wx things
Posts: 31
Joined: Sun Nov 07, 2010 5:19 pm

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

Post by Nico »

Hello,

I am trying to build an older codeblocks plugin that depends on wxWidgets, so my problem might be related to a version difference but I hope somebody here can tell me how to fix it.

The plugin includes $(#wx)\include\wx\platform.h where in my case $(#wx) refers to C:\wxWidgets-3.0.0.

In plathform.h I get a fatal error:
C:\wxWidgets-3.0.0\include\wx\platform.h|189|fatal error: wx/setup.h: No such file or directory

because this include seems to be impossible:

Code: Select all

/*
   Include wx/setup.h for the Unix platform defines generated by configure and
   the library compilation options

   Note that it must be included before defining hardware symbols below as they
   could be already defined by configure but it must be included after defining
   the compiler macros above as msvc/wx/setup.h relies on them under Windows.
 */
#include "wx/setup.h"
I have checked and indeed there is no "C:\wxWidgets-3.0.0\include\wx\setup.h" like there was in wxWidgets 2.8.11.
Just in case it is of any importance: I'm using code::blocks 13.12 RC1 and the plugin is cbGcov (add code coverage to code::blocks)

My questions:
Using wxWidgets 3.0.0 in 32bit mode on windows 8 with gcc 4.7.1 compiler, how can i get this program to compile without causing future problems with the wxWidgets installation? Can I create an empty setup.h? Can I create a setup.h file with the proper content? Should I omit the include in platform.h ( I would probably feel uncomfortable doing that as I don't know what side effects it might have)? Should I add some other search-directory? Is there an other solution?

I hope somebody here is willing and able to help me on this one.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax »

A project needs at least two include paths.

Each different configuration has its own setup.h, it's included from a different location than all other header files.

The exact location depends on the compiler and configuration.
E.g. in Visual Studio, Unicode / Debug build it would be:

Code: Select all

<wxdir>\lib\vc_lib\mswud\
This include path must be given first in the command line.
Use the source, Luke!
Nico
Knows some wx things
Knows some wx things
Posts: 31
Joined: Sun Nov 07, 2010 5:19 pm

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

Post by Nico »

Thanks, I feel a bit stupid but you did get me a big step further.

Kind regards, Nico
alan93
Experienced Solver
Experienced Solver
Posts: 93
Joined: Wed Feb 06, 2013 9:33 pm

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

Post by alan93 »

doublemax wrote:A project needs at least two include paths.

Each different configuration has its own setup.h, it's included from a different location than all other header files.

The exact location depends on the compiler and configuration.
E.g. in Visual Studio, Unicode / Debug build it would be:

Code: Select all

<wxdir>\lib\vc_lib\mswud\
This include path must be given first in the command line.
I ran into this same problem using Visual Studio .
After installing wx 3.0.0 I got setup.h here:
<wxdir>\include\msvc\wx\setup.h

I had no vc_lib folder

but including this in project did not solve it.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax »

There is a "master copy" of setup.h in <wxdir>\include\wx\msw\

When you build the libraries of a specific configuration, this version will be copied into the respective directory for this configuration. e.g. <wxdir>\lib\vc_lib\mswud\wx\

The latter is the path that always needs to be on top of the list of include paths, because that's the one where "setup.h" loaded from. All other include files come from <wxdir>\include\wx\
Use the source, Luke!
cdavalillo
In need of some credit
In need of some credit
Posts: 1
Joined: Sun Jan 07, 2018 1:19 pm

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

Post by cdavalillo »

Hello Im new in this but for me the solution was to replace the instruction #include "wx/setup.h" by this other #include "wx/msw/setup.h" in the platform.h file because I did install the 3.1.0 version of wxWidgets and the setup.h file need by the gcc compiler (MinGW) was in this folder.....
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax »

cdavalillo wrote:Hello Im new in this but for me the solution was to replace the instruction #include "wx/setup.h" by this other #include "wx/msw/setup.h" in the platform.h file because I did install the 3.1.0 version of wxWidgets and the setup.h file need by the gcc compiler (MinGW) was in this folder.....
You should never have to edit the source code to make wxWidgets compile. What you did only masks the real problem temporarily, but can cause more trouble in the long run.

Like i wrote in the post above, the setup.h in "include/wx/msw/" is the "master" copy that will be copied to a project-specific directory, e.g. <wxdir>\lib\vc_lib\mswud\wx\ for the "unicode, debug" configuration when using Visual Studio.

In your actual project, you'll need two include paths. The project-specific one from which only setup.h will get included and the default one "<wxdir>/include/" from which all other headers will be included.
Use the source, Luke!
shahbazkhan22
In need of some credit
In need of some credit
Posts: 1
Joined: Sat Oct 06, 2018 4:22 am

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

Post by shahbazkhan22 »

Other Simple method is by copying that 'setup.h' from location '<wx_dir>\lib\gcc_lib\mswu\wx' to the folder where your 'platform.h' is present. And edit the line '#include "wx/setup.h" ' as '#include "setup.h" '.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax »

shahbazkhan22 wrote:Other Simple method is by copying that 'setup.h' from location '<wx_dir>\lib\gcc_lib\mswu\wx' to the folder where your 'platform.h' is present. And edit the line '#include "wx/setup.h" ' as '#include "setup.h" '.
No, no and no. Never do that!
Use the source, Luke!
traderjoel
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Oct 15, 2018 2:31 pm

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

Post by traderjoel »

I'm trying to help out the OP here...

To fix the "fatal error: wx/setup.h: No such file" issue,

make sure the GCC command line has BUILD=release option. Chances are that the OP built wxWidgets using release. By default the debug version is being built. Therefore it is searching for setup.h under the debug folder lib\gcc_lib\mswud, but it is located under lib\gcc_lib\mswu, which is the release folder.
diswantsho
In need of some credit
In need of some credit
Posts: 6
Joined: Sun Apr 26, 2015 10:11 am

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

Post by diswantsho »

I also upgraded an old project to a newer wxWidgets and got the same error.
Besides correcting the include path, I had to change the preprocessor
WINVER=0x400
to:
wxMSVC_VERSION_AUTO
Post Reply