Compiling Using MSVC On The Commandline

From WxWiki
Jump to: navigation, search

Compiling using MS Visual 2012 For Desktop

1.) Open the command prompt (cmd.exe) and navigate to the build\msw directory in your wxWidgets root:

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\wxUser>cd C:\wxWidgets-2.9.4\build\msw

If you have installed wxWidgets via the MSW Installer, you can also use the WXWIN variable:

cd %WXWIN%\build\msw

If you have downloaded wxWidgets from its repository (i.e. not as a download package from the website), you have to create setup.h as it doesn't exist in the repository:

COPY C:\wxWidgets-2.9.4\include\wx\msw\setup0.h C:\wxWidgets-2.9.4\include\wx\msw\setup.h

This step is not necessary if you use a release archive.

In any case you can edit wx\msw\setup.h file to change compilation options but this is purely optional.

2.) Then, execute the following command:

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"

This will temporarily inject some needed paths (e.g. the one to nmake.exe) into the environment variable PATH.

3.) You're now ready to compile wxWidgets:

nmake.exe -f

This will build wxWidgets in debug mode (Unicode is activated by default). You can pass other compile flags such as BUILD=release for release mode:

nmake.exe -f BUILD=release

Please click here for more compile flags.

Compiling using MS Visual C++ 6.0

Though this software is outdated, someone could find this information still useful.

The procedure is the same as mentioned above except the path of vcvarsall.bat: