Search code examples
c++includecodeblockswxwidgets

wxwidgets setup.h "no such file"


I have a straight forward install of wxWidgets 2.8.8 for Windows straight from the wxWidgets website.

Whenever I try to compile anything (such as the sample app described in "First Programs for wxWidgets" - http://zetcode.com/tutorials/wxwidgetstutorial/firstprograms/ ) I get:

wx/setup.h: No such file or directory

I've included both C:\wxWidgets-2.8.8\include and C:\wxWidgets-2.8.8\include\wx in my compiler search list.

The same thing happens if I try to use an IDE integrated with wxWidgets (such as Code::Blocks) - and this, I would have thought, would have just worked out the box...

Why is setup.h not found?


Solution

  • wxWidgets is not built into useable libraries when you "install" the wxMSW installer. This is because there are so many configurable elements, which is precisely what the setup.h you refer to is for.

    If you just want to build it with default options as quickly as possible and move on, here is how:

    1. Start the "Visual Studio Command Prompt." You'll find this in the start menu under "Microsoft Visual Studio -> Visual Studio Tools".

    2. Change to folder: [WXWIN root]\build\msw

    3. Build default debug configuration: nmake -f makefile.vc BUILD=debug

    4. Build default release configuration: nmake -f makefile.vc BUILD=release

    5. Make sure the DLLs are in your PATH. They'll be found in [WXWIN root]\lib\vc_dll

    6. Under the DLL folder mentioned above, you will find subfolders for each build variant (The instructions above made two, debug and release.) In each variant folder you'll find a 'wx' folder containing a 'setup.h" file. You'll see that the setup.h files are actually different for each build variant. These are the folders you need to add to your project build configuration include path, one per build variant. So, for example, you'd add [WXWIN root]\lib\vc_dll\mswud to the include path for your debug build, [WXWIN root]\lib\vc_dll\mswu for your release build.

    7. It is possible to build lots of other variant combinations: static libs, monolithic single library, non-Unicode, etc. See [WXWIN root]\docs\msw\install.txt for much more extensive instructions.