The Allegro Wiki is migrating to github at

Using the Optimizing VC7 compiler with the VC6 IDE

From Allegro Wiki
Jump to: navigation, search
Broom icon.png
This article or section is messy and needs some minor revision to bring it up to quality standards. Please help Allegro by editing it. When the article is formatted correctly, you may remove this tag.

Everyone knows that the Visual Studio 6 IDE is a fine IDE, but there's one problem: it's attached to an outdated compiler. When the VC6 compiler was written, there was no true ANSI C++. There was an idea of what C++ should look like, but nothing was formalized.

That is not the case today. Today, we have an ANSI C++, and we have a standardized C++ standard library.

But Visual C++ 6 is still a very popular tool (due to low cost), but it's compiler is not ANSI compliant in many significant areas. VC++ 7.1's compiler, however, is about as ANSI standard as C++ compilers get. However, it is a highly expensive piece of software, since Microsoft no longer sells it separately from the rest of Visual Studio, so you have to buy VC#, VB, and a few other tools along with it.

Fortunately, Microsoft released the VC++ 7.1 compiler as a free download, known as the VC++ Toolkit 2003. It is possible to replace the VC++ 6.0 compiler with this one.

Obviously, since the compiler is a command-line application, one could write a regular old Makefile to call the functions in question. However, this bypasses one of the main reasons to use an IDE to program with. So, this document will show you how to set up VC++ 6.0 with the 7.1 compiler.

Note: one can even use the VC++ 7.0 Standard version's IDE with the 7.1. This is very straightforward, so there is little need to go over the procedure.Insert non-formatted text here

Before we begin, I would like to point out this: while this procedure functions, it does have one flaw: Visual C++ 6.0 seems to be unable to read the debug info produced by the 7.1 compiler, so you will be unable to use the debugging features of 6.0.

The first step is simple: go to and download the VC++ Toolkit. Install it in some directory.

In VC++ 6.0, you will need to add the location of the \bin directory where you installed the ToolKit. So, if you installed the ToolKit in "C:\PROGRAM FILES\MICROSOFT VISUAL C++ TOOLKIT 2003", you will need to add the "C:\PROGRAM FILES\MICROSOFT VISUAL C++ TOOLKIT 2003\BIN" directory into VC++ 6.0's executable directory. Do this by going to Tools->Options->Directories->Executable Files. Move this new directory to the very top.

This will allow VC++ to call the toolkit's compiler/linker. However, to get this to actually work, something more will need to be done. When you create a VC++ probject, VC++ will add a /GZ option (compile-time option) to your debug builds. This option activates certain runtime-checks under the 7.1 compiler, checks that do not work with libraries from older versions. As such, you will need to remove this option in order to compile under debug.

Lastly, to deal with a bug involving the internal ftol function, you will need to add the following code snippets to the beginning of a number of your C++ files (preferably by way of a global header, possibly precompiled): <scode>

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }

This should be all you need to get up and running. But, sadly, not debugging.