sharptooth
sharptooth

Reputation: 170479

Is it possible to compile both 32-bit and 64-bit configurations without restarting Visual Studio?

Currently Visual Studio just starts cl.exe for C++ source compilation. cl.exe needs to be in one of folders listed on the %PATH% environment variable.

Since there're separate versions of cl.exe for 32-bit and 64-bit compilation in order to compile a 32-bit project after compiling a 64-bit project it is necessary to restart Visual Studio.

The typical solution is to have two .cmd files each settings %PATH% appropriately and then starting Visual Studio. Is there a solution that doesn't require restarting Visual Studio?

Upvotes: 0

Views: 3298

Answers (3)

DrPizza
DrPizza

Reputation: 18340

Currently Visual Studio just starts cl.exe for C++ source compilation. cl.exe needs to be in one of folders listed on the %PATH% environment variable.

That isn't true. VS does not depend on the path to locate cl.exe (cl.exe is not in my path, but VC++ can compiler perfectly well regardless). I think it uses either the registry, or else it uses the configuration stored in Tools/Options/Projects and Solutions/VC++ Directories.

Since there're separate versions of cl.exe for 32-bit and 64-bit compilation in order to compile a 32-bit project after compiling a 64-bit project it is necessary to restart Visual Studio.

No, just create different targets for the project.

Upvotes: 0

stijn
stijn

Reputation: 35901

You do not have to restart. Just setup two 'Solution Platforms' (Win32 and x64 for example) in your solution and projects and you are ready to go, as Visual Studio will automatically find the correct tools.

Upvotes: 6

xtofl
xtofl

Reputation: 41509

There is always the Build->Batch Build command, in which you can select the configurations to build.

Upvotes: 0

Related Questions