Page 1 of 1

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

Posted: Sun Dec 08, 2013 8:46 pm
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.

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

Posted: Sun Dec 08, 2013 8:51 pm
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.

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

Posted: Sun Dec 08, 2013 9:36 pm
by Nico
Thanks, I feel a bit stupid but you did get me a big step further.

Kind regards, Nico

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

Posted: Thu Dec 12, 2013 9:11 pm
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.

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

Posted: Thu Dec 12, 2013 9:19 pm
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\

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

Posted: Sun Jan 07, 2018 1:32 pm
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.....

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

Posted: Sun Jan 07, 2018 1:49 pm
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.

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

Posted: Sat Oct 06, 2018 4:27 am
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" '.

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

Posted: Sat Oct 06, 2018 8:20 am
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!

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

Posted: Mon Oct 15, 2018 3:19 pm
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.

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

Posted: Wed Jan 09, 2019 8:43 pm
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