Installing WxWin For MS Free Tools

From WxWiki
Jump to: navigation, search
This article applies to the following versions
Platform wxWidgets Visual C++
Windows XP 2.4.2 Toolkit 2003
Status: Out of Date

wxWindows 2.4.2 with free Microsoft development tools

To compile the wxWindow library install the the following...

  • Start the Visual C++ Toolkit 2003 Command Prompt found on the start menu.
  • Now Run the following commands to compile the libraries.
 "c:\program files\microsoft sdk\setenv.bat" /RETAIL
 set PATH=%PATH%;%MSSDK%\bin\Win64
 set WXWIN=C:\wxWindows-2.4.2
 cd C:\wxWindows-2.4.2\src                -> should be 'cd C:\wxWindows-2.6.?\build\msw' for wxWindows-2.6 
 nmake makefile.vc FINAL=1 cleanall
 nmake makefile.vc FINAL=1


To compile the samples you need the following additional components

  • Start the Visual C++ Toolkit 2003 Command Prompt found on the start menu.
  • Now Run the following commands to compile the libraries.
c:\program files\microsoft sdk\setvars.bat /RELEASE
set PATH=%PATH%;%MSSDK%\bin\Win64
set WXWIN=C:\wxWindows-2.4.2
cd C:\wxWindows-2.4.2\samples
nmake makefile.vc FINAL=1 clean
nmake makefile.vc FINAL=1

Development snapshot wxWindows 2.5.3 with free Microsoft development tools

Download and install the Microsoft Visual C++ Toolkit 2003 and the Microsoft Platform SDK February 2003. Using Internet explorer seems easiest. In the Platform SDK, you need the Core and Internet components.

Using Visual C++ Toolkit 2003 from the Command Prompt

Put these settings in a batch file, eg vc2003.bat and run it before trying to compile

set MSVC=[VC++ install dir]
set MSSDK=[Platform SDK install dir]

set INCLUDE=%MSVC%\include;%MSSDK%\include
set LIB=%MSVC%\lib;%MSSDK%\lib
set PATH=%MSVC%\bin;%MSSDK%\bin;%MSSDK%\bin\win64;%PATH%

Please note the PATH setting: "%MSSDK%\bin\win64" must be specified after "%MSVC%\bin" and "%MSSDK%\bin" so that only the missing WIN32 tools are searched in the WIN64 toolset.

I then was able to build the wxWidgets 2.5.2 libraries, the "minimal" and "image" sample the "life" demo and the and wxhatch program. At the time of writing, you need to manually remove the command to link odbc32.lib from each projects makefile.vc.

Then run :

nmake -f makefile.vc BUILD=release SHARED=0 RUNTIME_LIBS=static

Note that the free tools don't seem to have the debugging libraries, so you can't do BUILD=debug. However, you can catch wxWidgets Debug messages and wxAsserts by adding DEBUG_INFO=0. You can debug the wxWidgets library and your programs and link to the release system librarires using

nmake -f makefile.vc RUNTIME_LIBS=static DEBUG_RUNTIME_LIBS=0

You may find it more convenient to set these in the build/msw/config.vc file, which will be used when building libraries and executables.

Note: I had two slight problems that you might avoid following these instructions:

  • start the build in ~\wxWidgets-2.5.3\build\msw and not in wxWidgets-2.5.3\src (a makefile.vc in ~\wxWidgets-2.5.3\src\msw is missing (whereas makefiles for other compilers do exist)
  • in file ~\wxWidgets-2.5.3\src\msw\app.cpp uncomment line #include <shlwapi.h> (or hack the #ifdef conditions) since this header is not available in Visual C++ Toolkit 2003 or Platform SDK and uncommenting it doesn't matter.

The most recent Platform SDK no longer includes the Win64 directory, and does not come with nmake.exe. However the .NET SDK does include nmake.exe. My vc2003.bat looks more like the following:

set MSVC=C:\Program Files\Microsoft Visual C++ Toolkit 2003
set MSSDK=C:\Program Files\Microsoft Platform SDK for Windows XP SP2
set DOTNETSDK=C:\Program Files\Microsoft.NET\SDK\v1.1
set INCLUDE=%MSVC%\include;%MSSDK%\include
set LIB=%MSVC%\lib;%MSSDK%\lib
set PATH=%MSVC%\bin;%MSSDK%\bin;%DOTNETSDK%\bin;%PATH%

Relevant links are:

Note by Ben Collver <collver at peak dot org>

How to debug with wxWidgets 2.5.3 and the free Microsoft development tools

It is possible to build debug target of wxWidgets 2.5.3 with Microsoft Visual C++ Toolkit 2003, but when a sample application is built that links against the wxWidgets debug libs, you get unresolved symbols. This is due to Microsoft Visual C++ Toolkit 2003 is missing the debug version of the C runtime library (libcmtd.lib). There is a way to fix this although: use libcmtd.lib from Microsoft .NET SDK v 1.1. I updated my vc-setup.bat with one more line, and a few lib/inc modifications as follows:

set MSVC=C:\Program Files\Microsoft Visual C++ Toolkit 2003
set MSSDK=C:\Program Files\Microsoft Platform SDK for Windows XP SP2
set DX=C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)
set VS=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
set INCLUDE=%MSVC%\include;%MSSDK%\include;%DX%\Include;%WXWIN%\include;%VS%\include
set LIB=%MSVC%\lib;%MSSDK%\lib;%DX%\Lib;%WXWIN%\lib;%VS%\lib
set PATH=%MSVC%\bin;%MSSDK%\Bin;%PATH%

I verified that it was possible to debug with this solution with Debugging tools for Windows.

Note by Emil Erlandsson, <emil at buglix dot org>

Based on work by Michele Galante
Original topic by chris elliott, biol75 at york.ac.uk
Updated by kevin davies, kevin dot davies at iinet dot net dot au