无法在 qtcreator 中编译 Qt 项目
Unable to Compile a Qt project in qtcreator
我无法编译一个简单的 Qt 项目(主窗口示例)。我通过命令 shell 和 QtCreator 也试过了。首先 qmake 应该使用命令规则创建 makefile uic 尽可能简单地将 my 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"
谢谢
我怀疑您的桌面工具包可能有问题。我尝试像您一样创建一个新的默认 mainwindow
项目,我看到前几个步骤如下所示:
14:48:15: Running steps for project untitled...
14:48:15: Starting: "D:\Qt\Qt5.6.0.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.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.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 源代码。希望这些信息能为您提供一些指示,以找出问题所在。
我最终找到了解决方案。如果它发生在我身上,它可能发生在任何人身上。实际上,在我安装 gitbash 之前一切都正常。我将 gitbash 的 bin 设置为变量系统到我的路径系统。但是 gitbach 包含 sh.exe 哪个 unix 工具。因此,每次我通过 Qtcreator 或控制台 2 uic_wrapper 构建时,都会创建一个 .sh 和一个 .bat,并且我所有的 makefile 都是 unix 类的。简而言之,永远不要为您的 WINDOWS 系统设置任何 UNIX 工具。 Mingw 可以包含 MSYS 保重!!至少大多数面向工具的开发都是类似 UNIX 的。
我无法编译一个简单的 Qt 项目(主窗口示例)。我通过命令 shell 和 QtCreator 也试过了。首先 qmake 应该使用命令规则创建 makefile uic 尽可能简单地将 my 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"
谢谢
我怀疑您的桌面工具包可能有问题。我尝试像您一样创建一个新的默认 mainwindow
项目,我看到前几个步骤如下所示:
14:48:15: Running steps for project untitled...
14:48:15: Starting: "D:\Qt\Qt5.6.0.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.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.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 源代码。希望这些信息能为您提供一些指示,以找出问题所在。
我最终找到了解决方案。如果它发生在我身上,它可能发生在任何人身上。实际上,在我安装 gitbash 之前一切都正常。我将 gitbash 的 bin 设置为变量系统到我的路径系统。但是 gitbach 包含 sh.exe 哪个 unix 工具。因此,每次我通过 Qtcreator 或控制台 2 uic_wrapper 构建时,都会创建一个 .sh 和一个 .bat,并且我所有的 makefile 都是 unix 类的。简而言之,永远不要为您的 WINDOWS 系统设置任何 UNIX 工具。 Mingw 可以包含 MSYS 保重!!至少大多数面向工具的开发都是类似 UNIX 的。