无法在qtcreator中编译Qt项目

时间:2016-06-30 07:10:03

标签: c++ qt build qmake

我无法编译一个简单的Qt项目(主窗口的示例)。我通过命令shell和QtCreator尝试了它。首先qmake应该使用命令规则uic创建makefile,以便将我的ui转换为简单的.h。

Qt Creator在控制台上显示以下警告/错误消息。

09:06:30: Running steps for project untitled...
09:06:30: Starting: "D:\QT\qt-everywhere-opensource-src-5.6.0\qtbase\bin\qmake.exe" C:\workspace_llb_27-05-2016\untitled\untitled.pro -r -spec win32-g++
09:06:32: The process "D:\QT\qt-everywhere-opensource-src-5.6.0\qtbase\bin\qmake.exe" exited normally.
09:06:32: Starting: "C:\mingw\mingwx64_481r0-sjlj-rev2\bin\mingw32-make.exe" 
C:/mingw/mingwx64_481r0-sjlj-rev2/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug'
/C/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug/uic_wrapper.sh ../workspace_llb_27-05-2016/untitled/mainwindow.ui -o ui_mainwindow.h
Makefile.Debug:318: recipe for target 'ui_mainwindow.h' failed
process_begin: CreateProcess(NULL, /C/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug/uic_wrapper.sh ../workspace_llb_27-05-2016/untitled/mainwindow.ui -o ui_mainwindow.h, ...) failed.
make (e=2): Le fichier spécifié est introuvable.

mingw32-make[1]: *** [ui_mainwindow.h] Error 2
mingw32-make[1]: Leaving directory 'C:/build_untitled_Qt_5_6_0_Built_by_mingwx64_481r0_sjlj_rev2_Debug'
Makefile:34: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2
09:06:33: The process "C:\mingw\mingwx64_481r0-sjlj-rev2\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project untitled (kit: Qt 5.6.0 (Built by mingwx64_481r0-sjlj-rev2))
When executing step "Make"

由于

2 个答案:

答案 0 :(得分:3)

我最终找到了解决方案。如果它发生在我身上,它可能发生在任何人身上。实际上在安装gitbash之前一切正常。我将gitbash的bin设置为变量系统到我的路径系统。但gitbach包含sh.exe,其中包含unix工具。因此,每次我通过Qtcreator或控制台2构建uic_wrapper都会创建一个.sh one .bat,而我的所有makefile都是unix之类的。简而言之,永远不要将任何UNIX工具设置为您的WINDOWS系统。 Mingw可以包含MSYS照顾!!至少大多数面向工具的开发都是像UNIX一样。

答案 1 :(得分:0)

我怀疑您的桌面套件可能有问题。我尝试创建一个新的默认mainwindow项目,就像你做的那样,我看到如下的前几个步骤:

14:48:15: Running steps for project untitled...
14:48:15: Starting: "D:\Qt\Qt5.6.0\5.6\mingw49_32\bin\qmake.exe" C:\untitled\untitled.pro -r -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
14:48:16: The process "D:\Qt\Qt5.6.0\5.6\mingw49_32\bin\qmake.exe" exited normally.
14:48:16: Starting: "D:\Qt\Qt5.6.0\Tools\mingw492_32\bin\mingw32-make.exe" 
D:/Qt/Qt5.6.0/Tools/mingw492_32/bin/mingw32-make -f Makefile.Debug

您可以注意到我的应用程序使用的qmake路径与您的路径之间存在差异。

Mine looks like this: D:\Qt\Qt5.6.0\5.6\mingw49_32\bin\qmake.exe
Yours looks like this: D:\QT\qt-everywhere-opensource-src-5.6.0\qtbase\bin\qmake.exe

我猜qt-everywhere-opensource-src-5.6.0看起来像是你从网上获取的Qt源代码。希望这些信息能给你一些指针,找出问题所在。

相关问题