gpt4 book ai didi

c++ - 如何强制 Visual Studio 2010 使用 x64?

转载 作者:行者123 更新时间:2023-11-30 04:27:32 26 4
gpt4 key购买 nike

每当我在 Visual Studio 2010 中创建一个新项目并且一开始没有设置特定平台(在我的例子中是 x64)时,之后我将无法完全更改它。所以我用外部库(编译为 x64)设置了所有需要的东西,然后按编译它显然失败了,因为两个平台不匹配。

sfml-graphics-s-d.lib(RenderStates.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

注意到我使用 Build->Configuration-Manager->Active projectplattform->New...->x64 将其更改为 x64。这与我在做任何其他事情之前都会做的事情是一样的,并且它有效,但如果我在之后做它,我会收到链接器错误:

libcpmtd.lib(uncaught.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

*.obj 文件可以在项目之间更改(例如 cout.obj),根据我的理解,Visual Studio 选择 x86 标准库并且在我切换平台后不会改变它的决定。

所以对于这个问题:我如何强制 VS 使用新指定的 x64 平台 - 也适用于标准库?

注意:创建新的配置设置会自动将目标机器的链接器设置更改为:MachineX64 (/MACHINE:X64)

注意:不确定它是否相关,但我正在静态链接运行时库Multithreaded-Debug (/MTd)

最佳答案

如果有人遇到和我一样的问题,他可以在 the MSDN 'forum' 找到讨论和解决方案。 .

OK, I found it, LibraryPath corresponds to Library Directories property in VC++ Directories project property page. That explains what happened, that value is usually inherited so it changes automatically when you create add x64. But since you modified that value it is now local to the project and it simply gets copied when add x64... with all those x86 specific dirs.

I suppose it's simpler and safer to just add that lib dir in Linker\General\Additional Library Directories

关于c++ - 如何强制 Visual Studio 2010 使用 x64?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10849420/

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