How to compile a wxWidgets application in Visual Studio 2008?

Step 1 – Install Visual Studio 2008

  1. If you don’t have it, get the express edition here: http://www.microsoft.com/Express/VC/
  2. Run through the installer, not much else to do.

Step 2 – Install wxWidgets

  1. Download wxWidgets (select the wxMSW installer file) from here:
    http://www.wxwidgets.org/downloads/
  2. I choose to install to c:\dev\wxwidgets\wxWidgets-2.8.10 but you can choose a different path if you want.

Step 3 – Create an environment variable for the wxWidgets path.

  1. Click the Start icon.
  2. Right click on Computer and choose Properties.
  3. Click Advanced system settings.
  4. Click the Environment variables button.
  5. Under System Variables, click New.
  6. Enter the Variable name: WXWIN
  7. Enter the Variable Value: C:\Dev\wxWidgets-2.8.10
  8. Click OK, click OK, click OK (yes three times).

Step 4 – Compile the wxWidgets Libraries.

  1. Browse to the following folder: C:\Dev\wxWidgets-2.8.10\build\msw
  2. Located the file called wx.dsw and open it with Visual Studio. (I just double-clicked on it.)
  3. Choose “Yes to all” when Visual Studio prompts you to convert the project.
  4. Build the project.
  5. Wait for the build to complete. It took approximately two minutes on my Lenovo T61p (dual core, 4 GB, Windows 7 64 bit). You should a line like this when it finishes successfully.
    ========== Build: 20 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  6. Close Visual Studio.

Step 5 – Create a new project

  1. In Visual Studio 2008, go to File | New Project.
  2. Select Visual C++ | Empty Project.
  3. Give the project a name and click OK. I named this wxTest.

Step 6 – Create/Copy your source to this project.

  1. Right-click on the Project name and choose Open Folder in Windows Explorer. This will open to the home folder of your project. (Don’t right click the Solution name, make sure to right click the project under the solution name.)
  2. Open a second Windows Explore window.
  3. In the second window, browse to the wxWidgets sample directory and open the Minimal folder: C:\Dev\wxWidgets-2.8.10\samples\Minimal
    Note: You can choose other projects but you may want to start with Minimal and move on from there.
  4. Copy only the minimal.cpp and minimal.rc files to your project directory (the rest are not needed).
  5. Close the second window pointing to the C:\Dev\wxWidgets-2.8.10\samples\Minimal directory, it is not needed anymore.
  6. From the explorer window open to your project directory, use ctrl+click to highlight both the minimal.cpp and minimal.rc files.
  7. Drag both highlighted files into the Visual Studio Window and drop them over the project name.
    The minimal.cpp file should automatically be placed under the Source files section of your project.
    The minimal.rc file should automatically be placed under the Resource files section of your project.

Step 7 – Customize the project properties

  1. Right-click on the wxTest project and select Properties. (Don’t right click the Solution name, make sure to right click the project under the solution name.)
  2. In the top left of the properties window there is a Configuration drop down menu. Select All Configurations.
  3. Click to expand Configuration Properties.
  4. Click to expand C/C++.

    Note: If you don’t see a C/C++ section, then you don’t have any source files.  You need at least one C++ source file for this section to show up.

  5. Click to highlight General.
  6. Enter the following in Additional Include Directories.
    $(WXWIN)\include;$(WXWIN)\lib\vc_lib\mswd
  7. Click to highlight Preprocessor.
  8. Enter the following in Preprocessor Definitions.
    WIN32;__WXMSW__;_WINDOWS;_DEBUG;__WXDEBUG__
  9. Click to expand Linker.
  10. Click to highlight General.
  11. Enter the following in Additional Library Directories.
    $(WXWIN)\lib\vc_lib
  12. Click to highlight Input.
  13. Enter the following in Additional Dependencies.
    wxmsw28d_core.lib wxbase28d.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxexpatd.lib winmm.lib comctl32.lib rpcrt4.lib wsock32.lib odbc32.lib

    Note: Not all of these libraries are required for this project, however, I list all of these because you may use some of them at some point. If you don’t think one is needed, remove it and recompile and if you don’t get errors, you were right, you probably didn’t need it.

  14. Click to expand Resources. (If you don’t see a Resources option, then you don’t have any files under resources so that is normal. Did you skip Step 5 because you probably should have added a resource in Step 5.)
  15. Click to highlight General.
  16. Enter the following in Preprocessor Definitions.
    _DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH
  17. Enter the following in Additional Include Directories.
    $(WXWIN)\include;$(WXWIN)\lib\vc_lib\mswd

You are now ready to build your wxWidgets application using Visual Studio 2008 on Windows 7.

Build your project and if you get any errors, go through it again, you probably missed a step (or I did, since I have already been caught with one step left out).


Copyright ® Rhyous.com – Linking to this article is allowed without permission and as many as ten lines of this article can be used along with this link. Any other use of this article is allowed only by permission of Rhyous.com.

75 Comments

  1. www.spectafresh.com

    How to compile a wxWidgets application in Visual Studio 2008? | Rhyous

  2. john lewis london 2012 store says:

    john lewis london 2012 store

    How to compile a wxWidgets application in Visual Studio 2008? | Rhyous

  3. […] How to compile a wxWidgets application in Visual Studio … – How to develop and compile wxwidgets code using visual studio…. […]

  4. Kelsey says:

    Update for wxWidgets 3.0: Some of the libraries in wxWidgets-3.0.0/lib/vc_lib have slightly different names (e.g ending in "ud" instead of "d", or having a "30" instead of "28"). So I had to tweak steps 6 and 13.

    Step 6: Change mswd to mswud.
    $(WXWIN)\include;$(WXWIN)\lib\vc_lib\mswud

    Step 13: The following libraries worked for me.
    wxmsw30ud_core.lib wxbase30ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib winmm.lib comctl32.lib rpcrt4.lib wsock32.lib odbc32.lib

    I also didn't have a Resources tab, which hasn't been a problem so far. Maybe it's because I'm using VS 2005?

  5. Mizuki says:

    Hi Rhyous,

    I follow your procedure step by step and it works perfectly. Thanks for the guide 😉

  6. Ilham says:

    Thanks, everything's worked well. 🙂
    Just remember to put 3 files from samples.
    - minimal.rc
    - minimal.cpp
    - simple.ico (add)
    I got an error appeared on 'minimal.rc' , it cannot find 'simple.ico' file.
    So, I copied it from sample folder. And re-built it.

    Thank You

  7. Karl Lagrange says:

    Just create a new EMPTY project - the linker errors should not appear when using this configuration.

  8. Maverick says:

    It keeps giving me the following error

    fatal error C1083: Cannot open include file: 'wxprec.h': No such file or directory

    I have ADDED the location to VC under Tools|Options. It tells me that if I want VC to look into a certain directory, I need to add it there. Well, I have added it there and it still gives me that error saying it cannot find it which is kind of contradictory.

    Any help would be appreciated. And yes, I have tried running the tutorial thrice.

    • Sebastian says:

      Hey I did what you did and it worked (thanks)
      I just have the error "Warning: Can not initialize OLE"
      Did you get that?
      Any idea what it means?
      Oh, and thanks for the tutorial

      • Maverick says:

        No I did not. Does it work though? I got a couple of errors but eventually it worked. Does it work for you? If it works, chances are you will not encounter any problems. I know it is a bad way of doing things programming, but as long as it works, I didn't care. It was annoying as is.

  9. Windows 7系统下配置wxWidgets与Visual studio 2008/2010 | 恒亮yucoat的博客 says:

    [...] 本文翻译自:https://www.rhyous.com/2009/12/16/how-to-compile-a-wxwidgets-application-in-visual-studio-2008/ 由于本站禁止使用右键,这导致文中的代码不能复制,你可以到原始文档去复制 [...]

  10. [...] 英文原文:  How to compile a wxWidgets application in Visual Studio 2008? [...]

  11. Jesse says:

    I had to delete the icon line in the resource file, then add #define wxUSE_NO_MANIFEST 1 at the top of the resource file, then change "Use Unicode Character Set" to "Use Multi-Byte Character Set" under "Character Set" in the General tab of the project properties. Then it all worked.

  12. Chris says:

    Howdy all,

    I've gone through all of the steps and I'm still getting the following error messages when I try to build:

    1>------ Build started: Project: wxTest, Configuration: Release Win32 ------
    1>Compiling...
    1>minimal.cpp
    1>Compiling resources...
    1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
    1>Copyright (C) Microsoft Corporation. All rights reserved.
    1>Linking...
    1>minimal.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssert(char const *,int,char const *,char const *)" (?OnAssert@wxAppConsole@@UAEXPBDH00@Z)
    1>minimal.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssertFailure(char const *,int,char const *,char const *,char const *)" (?OnAssertFailure@wxAppConsole@@UAEXPBDH000@Z)
    1>minimal.obj : error LNK2001: unresolved external symbol "void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)" (?wxOnAssert@@YAXPBDH000@Z)
    1>C:\Users\lifepupil\Documents\Visual Studio 2008\Projects\wxTest\Release\wxTest.exe : fatal error LNK1120: 3 unresolved externals
    1>Build log was saved at "file://c:\Users\lifepupil\Documents\Visual Studio 2008\Projects\wxTest\wxTest\Release\BuildLog.htm"
    1>wxTest - 4 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Prior to this message I was getting the sample.iso error that some of you described. I removed the first line in the minimal.rc and the above errors have followed - not that I'm suggesting that removing that line is the cause of the problem.

    I've been at this for some time and would be happy to receive any advice...

  13. Aiden Garrett says:

    OK, so i'm pretty sure i followed this exactly as you've said, but i've got a few problems.
    In the process of compiling / linking, it first came up with an error about not being able to find the icon file (not a problem, i just deleted the line). Now I have this error message: "Error 1 error LNK2001: unresolved external symbol "protected: virtual class wxString __thiscall wxAppTraitsBase::GetAssertStackTrace(void)" (?GetAssertStackTrace@wxAppTraitsBase@@MAE?AVwxString@@XZ) wxmsw28d_core.lib"
    I'd appreciate any help you can offer.

  14. tim-oleksii says:

    If you experienced problem with wxScintilla 'wx/setup can't be found' correct wx/platform.wx. Write insted of "wx/setup.h" "wx/msw/setup.h"

  15. lindarawson says:

    rhyous....I need some consulting help. Can you contact me?

    Thanks,
    Linda Rawson
    linda.rawson@sensorytech.net

  16. Andy says:

    I followed all the steps and when I went to compile the sample, I got an error that it couldn't find the .ico file. So, I found it, included it in the resources, and it STILL gave me the error. If someone could help me with this, I would appreciate it. I've got a project due on Sunday in my Object Oriented Programming II class that uses wxwidgets and I need to get this working so that I can do this project. Thanks.

  17. Taha says:

    First of all i thank the author with such a great article it really helped me but most of you are facing problem which i faced you so i decided to write an article with pictures and it solve the problem which the writer forgets unfortunately and i have decided using wxwidget 2.8.11 which is current stable release to date. Here is the article i will appreciate if you will read and comment.
    http://programmingreference.com/content/compiling-wxwidgets-visual-studio-2008

  18. Skoobie Du says:

    I don't think you should use the 'lib' directory for includes directly. You should use the following for your 'Additional Include Directories' setting: "$(WXWIN)\include;$(WXWIN)\include\msvc"

    The 'msvc' directory contains a 'wx' directory, which contains a 'setup.h' file. The 'setup.h' file is a wrapper around the 'setup.h' file located in the 'lib' directory. It will include the appropriate 'setup.h' file for the configuration you're using. The way you're doing it is specific to a particular configuration. Using what I've described will work for all configurations (32-bit/64-bit Debug/Release ANSI/Unicode [Monolithic]).

    Also, for VS10, just use 'VC++ Directories' instead of the 'Additional Include/Library Directories' settings. The 'VC++ Directories' are now project and configuration specific in VS10.

    Do what you prefer, I'm just providing information.

  19. Michel Hoche-Mong says:

    This worked fine for me in VS 2010 Ultimate and wxWidgets-2.9.1 too. There were a couple of catches:

    Step 7, Item 6: With the previous steps, only the "u" libaries were built. Therefore I had to change this to "$(WXWIN)\include;$(WXWIN)\lib\vc_lib\mswud".

    Step 7, Item 8: VS 2010 is very fussy about whether _DEBUG is defined, and if you try to link things compiled with it against libraries compiled without it you'll get complaints about like "error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' ". Also, there're some Preprocessor Definitions that are already there. So the Debug Preprocessor Definitions are

    _MBCS;%(PreprocessorDefinitions);WIN32;__WXMSW__;_WINDOWS;_DEBUG;__WXDEBUG__

    and the release ones are

    _MBCS;%(PreprocessorDefinitions);WIN32;__WXMSW__;_WINDOWS;__WXDEBUG__

    Step 7, Item 13:

    By default, odbc32.lib is inherited, so there's no need to add it to the extra libs.
    Second, since I'm using wxWidgets-2.9.1, the base name for the libraries has "29" in it instead of 28.
    Finally, I had to use the "u" version of the libs as mentioned above.

    So now the debug version of the Linker Additional Dependencies becomes:

    wxmsw29ud_core.lib;wxbase29ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;%(AdditionalDependencies)

    and the release is:

    wxmsw29u_core.lib;wxbase29u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;%(AdditionalDependencies)

    Great how-to doc!

    -michel

    • rhyous says:

      Thanks for these updated steps.

    • orion says:

      This is what I got after done what u said.
      Crap.! 🙁

      Error 1 error C1083: Cannot open include file: 'wx/setup.h': No such file or directory d:\wxwidgets-2.8.11\include\wx\platform.h 196 1 Test
      2 IntelliSense: #error directive: "wxUSE_CRASHREPORT must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 95 9
      3 IntelliSense: #error directive: "wxUSE_DYNLIB_CLASS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 103 9
      4 IntelliSense: #error directive: "wxUSE_EXCEPTIONS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 111 9
      5 IntelliSense: #error directive: "wxUSE_FILESYSTEM must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 119 9
      6 IntelliSense: #error directive: "wxUSE_FS_ARCHIVE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 127 9
      7 IntelliSense: #error directive: "wxUSE_DYNAMIC_LOADER must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 140 9
      8 IntelliSense: #error directive: "wxUSE_LOG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 148 9
      9 IntelliSense: #error directive: "wxUSE_LONGLONG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 156 9
      10 IntelliSense: #error directive: "wxUSE_MIMETYPE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 164 9
      11 IntelliSense: #error directive: "wxUSE_ON_FATAL_EXCEPTION must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 172 9
      12 IntelliSense: #error directive: "wxUSE_PRINTF_POS_PARAMS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 180 9
      13 IntelliSense: #error directive: "wxUSE_PROTOCOL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 188 9
      14 IntelliSense: #error directive: "wxUSE_REGEX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 230 9
      15 IntelliSense: #error directive: "wxUSE_STDPATHS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 238 9
      16 IntelliSense: #error directive: "wxUSE_XML must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 246 9
      17 IntelliSense: #error directive: "wxUSE_SOCKETS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 254 9
      18 IntelliSense: #error directive: "wxUSE_STREAMS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 262 9
      19 IntelliSense: #error directive: "wxUSE_STOPWATCH must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 270 9
      20 IntelliSense: #error directive: "wxUSE_TEXTBUFFER must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 278 9
      21 IntelliSense: #error directive: "wxUSE_TEXTFILE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 286 9
      22 IntelliSense: #error directive: "wxUSE_URL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 302 9
      23 IntelliSense: #error directive: "wxUSE_VARIANT must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 310 9
      24 IntelliSense: #error directive: "wxUSE_ABOUTDLG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 330 9
      25 IntelliSense: #error directive: "wxUSE_ACCEL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 338 9
      26 IntelliSense: #error directive: "wxUSE_ANIMATIONCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 346 9
      27 IntelliSense: #error directive: "wxUSE_BITMAPCOMBOBOX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 354 9
      28 IntelliSense: #error directive: "wxUSE_BMPBUTTON must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 362 9
      29 IntelliSense: #error directive: "wxUSE_BUTTON must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 370 9
      30 IntelliSense: #error directive: "wxUSE_CALENDARCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 378 9
      31 IntelliSense: #error directive: "wxUSE_CARET must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 386 9
      32 IntelliSense: #error directive: "wxUSE_CHECKBOX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 394 9
      33 IntelliSense: #error directive: "wxUSE_CHOICE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 410 9
      34 IntelliSense: #error directive: "wxUSE_CHOICEBOOK must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 418 9
      35 IntelliSense: #error directive: "wxUSE_CHOICEDLG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 426 9
      36 IntelliSense: #error directive: "wxUSE_CLIPBOARD must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 434 9
      37 IntelliSense: #error directive: "wxUSE_COLLPANE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 442 9
      38 IntelliSense: #error directive: "wxUSE_COLOURDLG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 450 9
      39 IntelliSense: #error directive: "wxUSE_COLOURPICKERCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 458 9
      40 IntelliSense: #error directive: "wxUSE_COMBOBOX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 466 9
      41 IntelliSense: #error directive: "wxUSE_COMBOCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 474 9
      42 IntelliSense: #error directive: "wxUSE_DATAOBJ must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 482 9
      43 IntelliSense: #error directive: "wxUSE_DATAVIEWCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 490 9
      44 IntelliSense: #error directive: "wxUSE_DATEPICKCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 498 9
      45 IntelliSense: #error directive: "wxUSE_DIRPICKERCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 506 9
      46 IntelliSense: #error directive: "wxUSE_DISPLAY must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 514 9
      47 IntelliSense: #error directive: "wxUSE_DOC_VIEW_ARCHITECTURE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 522 9
      48 IntelliSense: #error directive: "wxUSE_FILEDLG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 530 9
      49 IntelliSense: #error directive: "wxUSE_FILEPICKERCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 538 9
      50 IntelliSense: #error directive: "wxUSE_FONTDLG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 546 9
      51 IntelliSense: #error directive: "wxUSE_FONTMAP must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 554 9
      52 IntelliSense: #error directive: "wxUSE_FONTPICKERCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 562 9
      53 IntelliSense: #error directive: "wxUSE_GAUGE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 570 9
      54 IntelliSense: #error directive: "wxUSE_GRAPHICS_CONTEXT must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 578 9
      55 IntelliSense: #error directive: "wxUSE_GRID must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 587 9
      56 IntelliSense: #error directive: "wxUSE_HELP must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 595 9
      57 IntelliSense: #error directive: "wxUSE_HYPERLINKCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 603 9
      58 IntelliSense: #error directive: "wxUSE_HTML must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 611 9
      59 IntelliSense: #error directive: "wxUSE_ICO_CUR must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 632 9
      60 IntelliSense: #error directive: "wxUSE_IFF must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 640 9
      61 IntelliSense: #error directive: "wxUSE_IMAGLIST must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 648 9
      62 IntelliSense: #error directive: "wxUSE_JOYSTICK must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 656 9
      63 IntelliSense: #error directive: "wxUSE_LISTBOOK must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 664 9
      64 IntelliSense: #error directive: "wxUSE_LISTBOX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 672 9
      65 IntelliSense: #error directive: "wxUSE_LISTCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 680 9
      66 IntelliSense: #error directive: "wxUSE_LOGGUI must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 688 9
      67 IntelliSense: #error directive: "wxUSE_LOGWINDOW must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 696 9
      68 IntelliSense: #error directive: "wxUSE_LOG_DIALOG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 704 9
      69 IntelliSense: #error directive: "wxUSE_MDI must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 712 9
      70 IntelliSense: #error directive: "wxUSE_MDI_ARCHITECTURE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 720 9
      71 IntelliSense: #error directive: "wxUSE_MENUS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 728 9
      72 IntelliSense: #error directive: "wxUSE_MSGDLG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 736 9
      73 IntelliSense: #error directive: "wxUSE_NOTEBOOK must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 744 9
      74 IntelliSense: #error directive: "wxUSE_ODCOMBOBOX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 752 9
      75 IntelliSense: #error directive: "wxUSE_PALETTE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 760 9
      76 IntelliSense: #error directive: "wxUSE_POPUPWIN must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 768 9
      77 IntelliSense: #error directive: "wxUSE_PRINTING_ARCHITECTURE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 776 9
      78 IntelliSense: #error directive: "wxUSE_RADIOBOX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 784 9
      79 IntelliSense: #error directive: "wxUSE_RADIOBTN must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 792 9
      80 IntelliSense: #error directive: "wxUSE_SASH must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 800 9
      81 IntelliSense: #error directive: "wxUSE_SCROLLBAR must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 808 9
      82 IntelliSense: #error directive: "wxUSE_SLIDER must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 816 9
      83 IntelliSense: #error directive: "wxUSE_SOUND must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 824 9
      84 IntelliSense: #error directive: "wxUSE_SPINBTN must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 832 9
      85 IntelliSense: #error directive: "wxUSE_SPINCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 840 9
      86 IntelliSense: #error directive: "wxUSE_SPLASH must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 848 9
      87 IntelliSense: #error directive: "wxUSE_SPLITTER must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 856 9
      88 IntelliSense: #error directive: "wxUSE_STATBMP must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 864 9
      89 IntelliSense: #error directive: "wxUSE_STATBOX must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 872 9
      90 IntelliSense: #error directive: "wxUSE_STATLINE must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 880 9
      91 IntelliSense: #error directive: "wxUSE_STATTEXT must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 888 9
      92 IntelliSense: #error directive: "wxUSE_STATUSBAR must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 896 9
      93 IntelliSense: #error directive: "wxUSE_TAB_DIALOG must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 904 9
      94 IntelliSense: #error directive: "wxUSE_TEXTCTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 912 9
      95 IntelliSense: #error directive: "wxUSE_TIPWINDOW must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 920 9
      96 IntelliSense: #error directive: "wxUSE_TOOLBAR must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 928 9
      97 IntelliSense: #error directive: "wxUSE_TOOLTIPS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 936 9
      98 IntelliSense: #error directive: "wxUSE_TREECTRL must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 944 9
      99 IntelliSense: #error directive: "wxUSE_VALIDATORS must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 952 9
      100 IntelliSense: #error directive: "wxUSE_WXHTML_HELP must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 960 9
      101 IntelliSense: #error directive: "wxUSE_XRC must be defined." d:\wxwidgets-2.8.11\include\wx\chkconf.h 968 9

  20. Simon Wakley says:

    Great - worked perfectly for me.

    note: Latest is C:\Dev\wxWidgets-2.8.11 not C:\Dev\wxWidgets-2.8.10

    Thanks

    Simon

  21. My bookmarks « Blog of Wadersoft says:

    [...] Visual Studio 2008 and wxWidgets [...]

  22. Joe Wilson says:

    Although I'm now having problems with "fatal error RC1015: cannot open include file 'wx/msw/wx.rc'" I checked and the file is there but my wxtest minimal project just can't seem to open it.

  23. Joe Wilson says:

    If anyone is having problems with understanding release and debug mode when compiling I spent hours trying to figure out how to change settings from debug to release. Some idiot at MS put it in front of my face. Find the little green arrow pointing to debug on the ribbon and click the down arrow next to the debug window. There you can select the type of build you want. Then go to build and click build. If you have dual processors it will take a few builds before everything builds with out errors.

  24. Joe Wilson says:

    Just to show how bad Google is, this site has no page rank. Google stop trying to make your algo so complicated. Msn and Yahoo are retards, you don't have to worry about them just make a good search engine. This page is probably the best written page on the net. Give credit where credit is due.

    Thanks, I'm a noooob and this page saved me countless hours of frustration.

  25. Padma says:

    Hi... Thanks for this detailed tutorial... I am able to make the minimal program work without any errors.

    However, when I try to do the same thing for the sample program mediaplayer, I get the following linker error:

    1>mediaplayer.obj : error LNK2019: unresolved external symbol "public: bool __thiscall wxMediaCtrl::ShowPlayerControls(enum wxMediaCtrlPlayerControls)" (?ShowPlayerControls@wxMediaCtrl@@QAE_NW4wxMediaCtrlPlayerControls@@@Z) referenced in function "public: void __thiscall wxMediaPlayerFrame::OnShowInterface(class wxCommandEvent &)" (?OnShowInterface@wxMediaPlayerFrame@@QAEXAAVwxCommandEvent@@@Z)

    I get 26 other linker errors like these, all of the same type. Any ideas, on why there is a problem.Any help would be greatly appreciated. Thanks.

    • rhyous says:

      Great if you have the minimal working then it is fairly easy to make everything work.

      You are probably missing a library such as wxmsw28d_media.lib in your Linker | Input section. Try adding that.

      If it still doesn't work, do this:

      Go to: C:\Dev\wxWidgets-2.8.10\Samples
      Open the Samples solution (And choose yes to upgrade everything.)
      Once it opens, scroll down to the mediaplayer project.
      Right-click on the mediaplayer project and choose build and see if that works.
      I am assuming this is going to work for you.
      Compare your settings in your project to the settings in the sample.

      Note: Be aware that the samples folder is located ..\.. from the lib folder so it adds Additional Include Directories as like this:
      .\..\..\lib\vc_lib\mswd,.\..\..\include,.,.\..\..\samples.

      However, you are not always going to create a project in the Samples directory, which is why in your projects you should NOT use ..\..\lib but instead you should use: $(WXWIN)\include;$(WXWIN)\lib\vc_lib\mswd

  26. anonymous says:

    here is a guide that some guy made which basically describes the same process but with a video http://amilkhanzada.blogspot.com/2010/02/how-to-set-up-wxwidgets-using-microsoft.html

  27. John says:

    For those of you who still have errors with including, try removing the quotes from the include directories, for me, for some reason it was hindering it.

    • rhyous says:

      WordPress maybe is changing the quotes so when you copy and paste, they are the normal quote characters.

      If you don't have spaces, you can remove the quotes. I think most poeple won't have spaces, so maybe I will remove them from this guide.

  28. Tj says:

    wxWidgets sucks. Wiki is wrong, and just about everything, just trying to get teh libraries to compile... Then when you do get them compiled, a project fails horribly with 160 external link errors in the .LIB files.

    What a load of crap.

  29. Gabriel says:

    Resolved!
    I re-installed VC++2008 express, and now it's working

    Thanks

  30. rhyous says:

    I haven't seen that before. I did see a lot about it when I googled for: error spawning mt.exe
    http://www.codeproject.com/Articles/50572/Error-spawning-mt-exe.aspx
    http://www.interact-sw.co.uk/iangblog/2005/09/12/cmdspawnerror

  31. Gabriel says:

    Hello:
    thanks for the tutorial!!
    I followed the instructions, everything is fine, except at the end I had the following: Error spawning 'mt.exe'.

    what does that means??
    thank you

    Compiling...
    minimal.cpp
    Compiling resources...
    Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    Linking...
    Embedding manifest...
    Project : error PRJ0003 : Error spawning 'mt.exe'.

  32. Barcode says:

    hey thx for that tutorial.
    but ive a problem.
    wen i build the minimal project i get that errormessage:

    1>------ Erstellen gestartet: Projekt: test, Konfiguration: Debug Win32 ------
    1>Kompilieren...
    1>minimal.cpp
    1>c:\wxwidgets-2.8.10\samples\minimal\minimal.cpp(21) : fatal error C1083: Datei (Include) kann nicht geöffnet werden: "wx/wxprec.h": No such file or directory
    1>Das Buildprotokoll wurde unter "file://c:\Users\Admin\Documents\Visual Studio 2008\Projects\test\test\Debug\BuildLog.htm" gespeichert.
    1>test - 1 Fehler, 0 Warnung(en)
    ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

    i tried to restart msv and i compiled wxwidgets one time as debug and one time after reinstalling as release unicode.

    can sb help me pls?

  33. Javier says:

    Thank you Rhyous for this awesome tutorial!!! Helped me alot =)

    I got only one problem wich was solved changing the straight “” quotes for non straight "" quotes in the project properties. Probably you may want to change the main post, cuz we like to copy & paste so much ;P

    Once again thank you for this tutorial!

  34. Kristian Berge Nessa says:

    I found I had to do the following additionally to get this to work properly (VC++ Express 2008):

    * When compiling wxWidgets, first set #define wxUSE_UNICODE 1
    (Otherwise I would get unresolved linker errors)

    * In the resource file (minimal.rc), add the line:
    #define wxUSE_NO_MANIFEST 1
    Otherwise I would get linker error about duplicate manifest.

  35. Jive Dadson says:

    Ah ha. Number 11 is related to my questions. I put edited the "Additional Include Directories" and it found the icon.

  36. Jive Dadson says:

    Thanks so much for doing this! I got a sample program up and going with hardly a glitch. One question though.

    At first, I got an error saying "sample.ico" could not be found. I know absolutely nothing about resources, but I found a file called sample.ico in the Wx installation, and I dragged it into the "Resource Files" section in Solution Explorer, and the program ran just fine. I do not know why it did not find the icon before I did that, or really how it found it after I did. Can you edify me, or point me to the documentation? Resources are a deep mystery to me.

    Thanks again!

    Jive

  37. Jonathan says:

    I also had to add "$(WXWIN)\samples" to Resources > General > Preprocessor Definitions to get it to compile.

  38. Jonathan says:

    Hey, I reload visual studio, and it doesn't complain about not being able to access any directory, but I still get:
    fatal error C1083: Cannot open include file: 'wx/wxprec.h': No such file or directory
    when I try to build the solution. I swear I've followed the tutorial to the t, is there anything I could be missing?

  39. TARIQUE says:

    very than you! it's work perfectly!

  40. BOA says:

    Hi, how do i compile a 64bit version of wxwidgets. I use both plateforme 32bit and 64bit
    Thanks.

  41. tukuniata says:

    After playing around with the setting in IDE(MS VC++ 2008) i finally get the problem solved.

    Frist of all, I compile my wxWidgets libraries by hand one after an other. Frist In the build configuration menu, i choose "debug". And i compile the Libraries in the order that i got from wxWiki:
    jpeg,
    png,
    tiff,
    zlib,
    regex,
    expat,
    base,
    net,
    odbc,
    core,
    gl,
    html,
    media,
    qa,
    adv,
    dbgrid,
    xrc,
    aui,
    richtext

    After that, i was getting an error saying 'wx/wxprec.h' : No such file or directory.
    In stand of writing those directories that are in this tutorial, I browser them. And that all.
    Now my program is running great. my wxWidgets are well install now.

    Thanks again for your tutorial it was so helpfull.
    I m suscribing to this thread if someone has a question i would happy to help.

    • BOA says:

      i had the same error, can't find ‘wx/wxprec.h'. The probleme is, visual studio can't find the env WXWIN, ur supposed to have a warnning tellin u that. The solution is simple when u finish step 17, u need to close visual studio and open it(to load env WXWIN).
      Hope it helped.

  42. tukuniata says:

    I would like it in MS CV++ 2008 if is it ok?

  43. tukuniata says:

    Yes, If is not a probem, i m getting into troublem right now.

    Thanks in advance.

  44. tukuniata says:

    HI Rhyous can you please make a set-by-set tutorial of how to compile and what to compile and what not.
    I tried the one in wiki but it did help a lot.
    ps. you have a very good tut in here, if we close our eyes on the step 4.
    Thanks in advance.

  45. rhyous says:

    Ah...you are so right. I retraced my steps and uninstalled and reinstalled wxWidgets but I didn't realize that uninstalled didn't remove my compiled files, so it wasn't a true test. I uninstalled and deleted the wxWidgets folder and then I am not getting the same error as Adam using these steps. I will add that step I forgot. Thank you for catching this.

    • Duy says:

      Hi Rhyous

      I have the same problem as Adam while trying to build wxWidgets libraries
      fatal error C1083: Cannot open include file: ‘wx/setup.h’: No such file or directory

      How you can solve this ones? or Have you just uninstalled and delete wxWidgets folder? In that case, it did not help me to solve problem.

  46. Roberto P says:

    Seems like the step of actually compiling wxWidgets itself is missing from this tutorial (I am not sure if that was implied). The wxWidgets download comes in source not binaries.

  47. Adam V. Smith says:

    fatal error C1083: Cannot open include file: 'wx/setup.h': No such file or directory

    • rhyous says:

      Adam, I don't get that error and I went through this article twice.

    • rhyous says:

      Adam,

      Let me know if the "Step 4 – Compile the wxWidgets Libraries." section resolves your issue.

      Thanks for helping me catch a missing step.

    • Carlos says:

      That happened to me too. Check that the build settings for Unicode are the same when you build a wxWidgets and when you build your project. There is one 'wx/setup.h' for each multi-byte, unicode, etc, and the compiler is looking to use one that has not been built yet.

    • Dallas says:

      I get the exact same error and I know it has to do with the dir not existing but I am not sure how to get around that 🙁

    • Extremo says:

      Open up the project wx file like described in step 4. Click on Build, select Batch Build. Then click select all and compile. Don't worry about those that do not compile. You will not need half of what you compile but this is easier then explaining you in depth what you could possibly need. So just compile all and it will be something around 200 successful and 100 failed or w/e. Then all should be fine and that error shouldnt appear anymore.

Leave a Reply to Jonathan

How to post code in comments?