Search code examples
visual-studiomakefile

Selecting a compiler for a make file


Say you have both VS2008 and VS 6 installed on your computer, and you wish to write an make file that will compile some C++ code using the VS 6.0 compiler. How can you do that? What is the way to control the selection of the compiler outside the make file?


Solution

  • I am not sure that VS 6.0 had VCVARS32.BAT but if there is VCVARS32.BAT then you need to set your environment using VCVARS32.BAT. See Building from the Command Line, "Running VCVARS32.BAT".

    If you need VS 2008 than you run VCVARS32.BAT from VS 2008.
    If you need VS 6.0 than you run VCVARS32.BAT from VS 6.0.

    Again, I am not sure that VS 6.0 had VCVARS32.BAT so check it.

    For example building Hello, World program might look like:

    "D:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat" && cl hello_world.cpp