Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ LNK112:模块计算机类型“x64”与目标计算机类型“X86”冲突:Qt创建者_C++_Qt_Qt4_Qt Creator - Fatal编程技术网

C++ LNK112:模块计算机类型“x64”与目标计算机类型“X86”冲突:Qt创建者

C++ LNK112:模块计算机类型“x64”与目标计算机类型“X86”冲突:Qt创建者,c++,qt,qt4,qt-creator,C++,Qt,Qt4,Qt Creator,我有一个在linux上运行的应用程序,我正试图在windows上导入它。我已设置了所有库,并对.pro文件进行了更改。现在,当我尝试构建项目时,出现以下错误: error: LNK1112: module machine type 'x64' conflicts with target machine type 'X86' 我不确定是什么导致了这个问题。我使用的是32位Qt creator。我知道有几个链接讨论如何更改项目属性,但所有这些都与在VisualStudio中更改项目属性有关。我正在

我有一个在linux上运行的应用程序,我正试图在windows上导入它。我已设置了所有库,并对.pro文件进行了更改。现在,当我尝试构建项目时,出现以下错误:

error: LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

我不确定是什么导致了这个问题。我使用的是32位Qt creator。我知道有几个链接讨论如何更改项目属性,但所有这些都与在VisualStudio中更改项目属性有关。我正在使用QtCreator并通过QtUI运行项目。因此,如果必须解决此问题,我不确定必须通过Qt对项目属性进行哪些更改。

我也遇到了同样的问题,但我的场景有点不同,我的目标是x64体系结构,当我将其更改为x86时,我遇到了此错误,我花了一些时间才明白我必须重新构建项目以匹配CPU体系结构。

很明显,您是为32位目标编译的,但您的一些库是64位的,这很可能您已经知道了

确保Qt Creator为您的特定项目使用了正确的编译器VC++、MinGW和机器型号32、64位

Select "Projects" from the left panel.
In the upper pane is shown the associated Kits for your project.
You can add more Kits with the "Add Kit v" button.
Hovering the mouse over the associated Kits, a little arrow is shown.
   Clicking on it provides operations to apply to the Kit.
You can change or remove the Kit from your project following this little arrow.
打开你的项目

File -> Open File or Project... -> ... -> yourproject.pro
检查Qt Creator是否自动检测到符合库的机器模型的编译器

Tools -> Options -> Build & Run -> Kits
选择定义项目所需的生成工具包和其他设置

Select "Projects" from the left panel.
In the upper pane is shown the associated Kits for your project.
You can add more Kits with the "Add Kit v" button.
Hovering the mouse over the associated Kits, a little arrow is shown.
   Clicking on it provides operations to apply to the Kit.
You can change or remove the Kit from your project following this little arrow.
根据新信息生成新的Makefile

Build -> Run qmake
从头开始重建

Build -> Rebuild All

我看到这篇文章是很久以前的事了,但我刚刚遇到了同样的问题,这可能是其他人再次遇到这个问题的解决方案。我有一个不同的设置,但我得到了相同的错误

我的应用程序在Windows和Visual Studio 2019上运行,我需要我的应用程序在x64和x86配置中正常工作。当我尝试在x86中运行我的项目时,我遇到了这个错误。这是我的解决办法

转到项目的属性页 确保您指向下面的正确Qt安装 您可以通过检查VS的Qt-VS-Tools扩展中的Qt选项来检查这一点。如果没有,请确保添加它。我说的Qt5.13.2对我来说是指向Qt的x64版本,但它需要指向x86版本

要更改此设置,您需要创建一个指向x86版本的Qt版本,并将Qt项目设置中的Qt安装更改为指向该版本。 在“Qt版本”选项卡下,检查属性页指向的Qt版本。如果您的配置不正确,您可以在此处创建另一个配置。 按Add按钮添加新的Qt版本

Build Host: Windows
Version name: <give it a name> (I did "Qt5.13.2_86")
Path: <Path to correct build> (mine was "C:\Qt\Qt5.13.2\5.13.2\msvc2017")
compiler: msvc (automatically sets to this when selecting Windows for the Build Host)
按OK

现在回到项目属性表中配置属性中的Qt项目设置下的Qt安装,并指向正确的Qt版本,我的版本是从5.13.2->5.13.286。
这是我针对不同问题的解决方案,但错误相同。

Somwwhere,必须调用Micorosft编译器和链接器命令行。查看MS链接器的命令行。@PaulMcKenzie正在使用VS10编译器构建项目。我不确定必须在哪里进行更改。从未使用Qt creator,但修复方法是访问链接器命令行并修复机器选项以使用X86。对不起,我不能再帮你了。
General -> Qt Installation
Extensions -> Qt VS Tools -> Qt Options
Build Host: Windows
Version name: <give it a name> (I did "Qt5.13.2_86")
Path: <Path to correct build> (mine was "C:\Qt\Qt5.13.2\5.13.2\msvc2017")
compiler: msvc (automatically sets to this when selecting Windows for the Build Host)