10.1.2.1 VC++ Environment Variables

There is a batch file in your VC++ installation’s bin directory called vcvars32.bat, which sets up the environment variables needed to run the VC++ command line tools. Arrange for those same environment variables to be set in your Emacs session. You can do this on Windows 9x by calling the vcvars32.bat script from autoexec.bat. On other versions of Windows you can set the environment variables globally using the System control panel.

For all versions of Windows you can alternatively set the variables just inside Emacs by using setenv calls in your init file. See Where do I put my init file?.

You should now be able to compile from Emacs. Load a source file from a VC++ project. Type M-x compile. Replace the proposed command line with:

nmake -f ProjectName.mak

You will find that this defaults to a debug build. You can change it to a release build with:

nmake -f ProjectName.mak CFG="ProjectName - Win32 Release"