1
votes

I have a Visual Studio solution with many projects in it. There are debug and release configurations for both x86 and x64, and when a particular combination is selected everything is successfully built in that format.

However, there is now a requirement that, regardless of the "bitness" currently selected, a certain C++ project should be compiled as both x86 and x64. So for example, when the solution is built in x86 debug mode, there should be two debug copies of the exe in the build directory, one x86 and one x64.

What is the easiest way to achieve this? I've tried making two copies of the project, exename_32 and exename_64. My first idea was to copy the contents of the Debug|x64 node in the .vcproj file into the Debug|Win32 node for exename_64. But when I try to build the solution in Win32 mode, I get the following errors for the exename_64 project:

20>c:\program files (x86)\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h(17) : error C2371: 'size_t' : redefinition; different basic types

20> predefined C++ types (compiler internal)(19) : see declaration of 'size_t'

20>C:\Users\melol\Desktop\local\march03\src\thirdparty\Microsoft SDKs\Windows\v6.0\include\winnt.h(81) : fatal error C1189: #error : "No Target Architecture"

The exe in question is a Windows command line utility with a wWinMain. The only two #includes are

#include <windows.h>
#include <iostream>

Thoughts?

1
One typically drops to command scripting and wrapping msbuild or nmake to call the project in x86 and x64 architectures.Steve-o
Is there a way of inducing the behaviour I want in Visual Studio? I'm not the only one working on the project so it's desireable that the general workflow and organization of the solution remain the same.ShiggityShiggityShwa

1 Answers

1
votes

You can definitely build 32/64 bit (and vice versa) in Visual Studio 2008.

The simplest way to achieve your task seems to be do it by using "Batch Build": http://msdn.microsoft.com/en-us/library/169az28z(v=vs.90).aspx

Use this dialog box to build multiple project configurations all at one time. You can decide, for example, to build every project configuration of a project with one command. You can access this dialog box from the Build menu.