Setting Up wxDev-C++ for compiling with Visual C++ 2005

Tony Reina

Installing Visual C++ 2005

1. You need to have Visual C++ 2005 installed. If you do not have it, download it from Microsoft. If you already have Visual Studio installed, you can obviously skip this step (the steps mentioned here apply to Visual Studio 2005 as well)

2. Download and install the Windows Server 2003 R2 Platform SDK.

3. The wxDev-C++ installer should include the wxWidgets Devpak for Visual C++ 2005. If you do not have it, download and install it

Configuring wxDev-C++

4. Go to Tools » Compiler Options » Compiler Tab. Create a new compiler, or use an existing compiler. Whatever the case, change the compiler type to be Visual C++ 2005

5. Click on the Directories tab, then the Binaries sub-tab. Add the "bin" directories used for Visual C++, the Platform SDK, and wxDev-C++.

6. Click on the Libraries sub-tab. Enter the Visual C++ and Platform SDK "lib" directories.

7. Go to the C includes sub-tab and enter the Visual C++, Platform SDK and wxDev-C++ include directories

8. Go to the C++ includes sub-tab and enter the same Visual C++, Platform SDK and wxDev-C++ include directories. The reason this step has to be repeated is because wxDev-C++ treats C and C++ projects differently. Don't worry, however, this is one-off.

9. Go to the Resource includes sub-tab and enter the wxDev-C++ include directory for the Resource includes.

10. Click the tab Programs tab. Make sure the programs are changed to the Visual C++ binaries.

-cl.exe for both the C++ and C compilers

-mingw-make.exe or make.exe for Make. Do not use nmake.exe! Undefined build targets will result - NMake requires that all tagets be declared before use, MingW's version does not. wxDev-C++ uses this to allow users to customize the makefile's behaviour

-rc.exe for the Resource compiler

-link.exe for the Linker

-cdb.exe for the Debugger. Debugger support is incomplete. As of now only MingW builds can be debugged from within the IDE. Support for cdb is expected the next release - alpha builds that support cdb are available at Joel's site - see the Downloads page.

-mt.exe for the Manifest Tool. Visual C++ 2005's run-time libraries when used under Windows XP and later need to be loaded by manifests. This tool is provided so that the generated .manifest files will be automatically embedded in the binaries so that a separate manifest file need not be distributed.

Testing everything out!

11. Go to File » New » Project. Choose wxWidgets Frame (MS VC++) or wxWidgets Dialog (MS VC++).

12. The new wxWidgets project files should be generated. You should check to see if the 'Default VC 2005 compiler' compiler (or whatever you named it) has been selected for the new project. You can do this by going to Project » Project Options » Compiler tab, and changing the compiler set to your compiler of choice

The wxWidgets devpak for VC 2005 is a monolithic, ANSI, release build with exception handling and OpenGL support. The build command was:

Quote:
set INCLUDE=C:\Program Files\Microsoft Platform SDK\include;%INCLUDE%

nmake -f makefile.vc BUILD=release MONOLITHIC=1 USE_OPENGL=1 USE_ODBC=1 RUNTIME_LIBS=static USE_RTTI=0 USE_EXCEPTIONS=1 VENDOR=wxdevcpp

I've tried to get the Template to correctly set the wxWidgets directories and switches, however you should probably verify these just in case.

13. Below the selected compiler, go to the section Code Generation, then set the Exception handling switch to C++ Exceptions (no SEH).

14. Finally, go to the Parameters tab and ensure that the command line switches are like in the screenshot below.

The libraries in the Linker section are:

wxmsw27.lib wxmsw27_gl.lib wxtiff.lib wxjpeg.lib

wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib

kernel32.lib user32.lib gdi32.lib comdlg32.lib

winspool.lib winmm.lib shell32.lib comctl32.lib

ole32.lib oleaut32.lib uuid.lib rpcrt4.lib

advapi32.lib wsock32.lib odbc32.lib opengl32.lib

You are of course free to add other library files your project depends on.

15. Switch to the Directories tab. By default, there are no paths for the Library Directories, Include Directories, and Resource Directories.

At this point, you should have a program that you can build and run. Do a "Save All" followed by a "Rebuild All". Enjoy!