致命错误LNK1112:模块机器类型“ x64”与目标机器类型“ X86”冲突Visual Studio 2010和cmake [英] fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' Visual studio 2010 and cmake

查看:135
本文介绍了致命错误LNK1112:模块机器类型“ x64”与目标机器类型“ X86”冲突Visual Studio 2010和cmake的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由cmake生成并在Visual Studio 2010中运行的项目。我将配置更改为x64,在我的主动解决方案的Visual Studio中,将(属性->链接器->高级)中的目标计算机设置为x64。我仍然收到链接器LNK1112错误。这是我在cmakelist.txt中设置的命令吗?
-swetha

I have a project which i have generated with cmake and running in visual studio 2010.I changed the configuration to x64,in visual studio my active solution and the Target Machine in(Properties->Linker->Advanced) is set as x64.I still get the linker LNK1112 error.Is this something which i set in cmakelist.txt if so what is the command? -swetha

推荐答案

您不是要在 CMakeLists.txt中设置的内容。基本上,CMake具有用于不同编译器的多个生成器。 (x86和x64编译器在Windows上是两个不同的编译器。)生成生成文件时,需要传递正确的编译器以供CMake使用,或者如果使用GUI,则选择Win64。从命令行:

It's not something you'd want to set in CMakeLists.txt. Basically, CMake has multiple generators for different compilers. (The x86 and x64 compilers are two distinct compilers on Windows.) When you generate the build files, you need to pass along the correct compiler for CMake to use, or if you use the GUI, select Win64. From the command line:

cmake -G "Visual Studio 14 Win64" path/to/your/CMakeLists.txt

或所需的任何Visual Studio版本。您可以通过以下方式查看可用的生成器:

or whatever version of Visual Studio you want. You can see the available generators with:

cmake --help

如果这不能解决您的问题,请在删除生成的生成文件后重试。

If this didn't solve your problem, try it again after deleting the generated build files.

如果仍然不能解决问题,则说明您链接到为x86构建的第三方依赖项。

If that still doesn't solve the issue, you are linking to a third party dependency built for x86.

这篇关于致命错误LNK1112:模块机器类型“ x64”与目标机器类型“ X86”冲突Visual Studio 2010和cmake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆