Compiling wxWidgets applications in the VC++ IDE

Settings for wxWidgets 2.2 / Settings for wxWidgets 1.68

To compile wxWidgets samples and applications using the VC++ 5.0 or 6.0 IDE (having compiled wxWidgets using the makefile or project file provided), the following steps and settings should be used.

Steps

  1. Create a new WIN32 Application project.
  2. Add the .cpp and .rc files for your project.
  3. Apply the settings listed below to the project, replacing c:\wx2 with your wxWidgets installation path.

Settings for wxWidgets 2.2

These settings apply to wxWidgets 2.1.14 and above but most of them are not necessary any longer for wxWidgets 2.3+.

General
The Output files and Intermediate files directory fields should be Debug for the Debug configuration, and Release for the Release configuration.

Debug: General
The Executable for debug sessions field should be altered to be the path and name you'd expect (it may have generated a different name).

C/C++: Preprocessor
The Preprocessor definitions field should contain the following symbols for Debug:

WIN32,_DEBUG,_WINDOWS,__WINDOWS__,__WXMSW__,__WXDEBUG__,WXDEBUG=1,
__WIN32__,WINVER=0x0400,STRICT

and these for Release:

NDEBUG,WIN32,_WINDOWS,__WINDOWS__,__WXMSW__,__WIN32__,
WINVER=0x0400,STRICT

The Additional include directories field should contain the following:

c:\wx2\include,c:\wx2\contrib\include

(and of course any other directories you wish to use in your project).

C/C++: Precompiled Headers
The Not using precompiled headers or Automatic use of precompiled headers button should be selected.

C/C++: Code Generation
The Use run-time library control should be set to Debug Multithreaded DLL (Debug) or Multithreaded DLL (Release).

Link: Input
The Object/library modules field should contain:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib
winmm.lib wxmsw25d.lib wxbase25d.lib wxpngd.lib wxzlibd.lib wxjpegd.lib wxtiffd.lib
for the Debug configuration and
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib
winmm.lib wxmsw25.lib wxbase25.lib wxpng.lib wxzlib.lib wxjpeg.lib wxtiff.lib
for the Release configuration.

The Ignore libraries field should contain:

libcd.lib,libcid.lib,msvcrt.lib
for the Debug configuration and
libc.lib,libci.lib,msvcrtd.lib
for the Release configuration.

The Additional library path field should contain

c:\wx2\lib,c:\wx2\contrib\lib
for both Debug and Release configurations.

Resources
Select your .rc file. The Additional resource include directories field should contain:
c:\wx2\include;c:\wx2\contrib\include

Settings for wxWidgets 1.68

Note: these have not yet been checked.

Debug: General
The Executable for debug sessions field should be altered to be the path and name you'd expect (it may have generated a different name).

General
The Output directories fields can be made blank if you want the objects and executable to be created in the project directory and not a subdirectory.

C/C++: Preprocessor
The Preprocessor definitions field should contain the following symbols:

WIN32,_DEBUG,_WINDOWS,wx_msw,DEBUG=1,WINVER=0x0400,STRICT

The Additional include directories field should contain the following:

../../include/base,../../include/msw

(and of course any other directories you wish to use in your project).

C/C++: Precompiled Headers
The Not using precompiled headers or Automatic use of precompiled headers button should be selected (I can't find a way of using the wxWidgets PCH file).

C/C++: Code Generation
The Use run-time library control should be set to Multithreaded DLL. This sets the compiler switch to /MD to match the wxWidgets makefile.

Link: Input
The Object/library modules field should contain:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib odbc32.lib odbccp32.lib comctl32.lib
../../lib/wx.lib ../../src/msw/dummy.obj
The Ignore libraries field should contain:
libcd.lib,libcid.lib

Resources
Select your .rc file. The Additional resource include directories field should contain:
..\..\include\msw;..\..\contrib\fafa