gpt4 book ai didi

c++ - 我可以在 Visual Studio 2008 中从 Win32 解决方案配置(反之亦然)编译 x64 exe 吗?

转载 作者:太空宇宙 更新时间:2023-11-04 11:57:21 24 4
gpt4 key购买 nike

我有一个包含许多项目的 Visual Studio 解决方案。 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.

但是,现在有一个要求,无论当前选择的“位数”如何,某个 C++ 项目都应该编译为 x86 和 x64。因此,例如,当在 x86 Debug模式下构建解决方案时,构建目录中应该有两个 exe 的调试拷贝,一个 x86 和一个 x64。

实现此目标的最简单方法是什么?我已经尝试制作该项目的两个拷贝,exename_32 和 exename_64。我的第一个想法是将 .vcproj 文件中 Debug|x64 节点的内容复制到 exename_64 的 Debug|Win32 节点中。但是,当我尝试在 Win32 模式下构建解决方案时,exename_64 项目出现以下错误:

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"

有问题的 exe 是带有 wWinMain 的 Windows 命令行实用程序。仅有的两个#include 是

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

想法?

最佳答案

您绝对可以在 Visual Studio 2008 中构建 32/64 位(反之亦然)。

完成任务的最简单方法似乎是使用“批量构建”来完成: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.

关于c++ - 我可以在 Visual Studio 2008 中从 Win32 解决方案配置(反之亦然)编译 x64 exe 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15661882/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com