【发布时间】:2020-01-10 13:31:57
【问题描述】:
我将Qt5 项目文件夹从一台计算机复制/粘贴到另一台计算机。他们都是Ubuntu 18.04。
Qt5 的相同版本和相同的库/依赖项。在新电脑上,我有CMake 3.10.2,但我不记得我在前一台电脑上的CMake 版本。 (可能是CMake 3.8)。
当我打开Qt5 并打开包含CMakeLists.txt 文件的文件夹并单击它时,我会从输出中得到以下结果:
08:02:22: Running steps for project newcam-proc...
08:02:22: Persisting CMake state...
08:02:22: Starting: "/usr/bin/snap" --build . --target all error: unknown flag `build'
08:02:22: The process "/usr/bin/snap" exited with code 1.
Error while building/deploying project myProject (kit: Desktop Qt 5.12.5 GCC 64bit)
The kit Desktop Qt 5.12.5 GCC 64bit has configuration issues which might be the root cause for this problem. When executing step "CMake Build"
08:02:22: Elapsed time: 00:00.
在General Message 下方我得到:
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_armv7/mkspecs/android-clang/qmake.conf.
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_x86/mkspecs/android-clang/qmake.conf.
Running /usr/bin/snap /home/emanuele/Desktop/myProject -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_PREFIX_PATH:STRING=/home/emanuele/Qt/5.12.5/gcc_64 -DQT_QMAKE_EXECUTABLE:STRING=/home/emanuele/Qt/5.12.5/gcc_64/bin/qmake in /tmp/QtCreator-vlHbHY/qtc-cmake-LvUefYdh.
error: unknown command "/home/emanuele/Desktop/myProject", see 'snap help'.
CMake process exited with exit code 1.
我以前的项目中从来不用Android NDK,也不必安装它。而且我不确定为什么在新机器上显示此消息。
此外,它似乎正在尝试使用snap 而不是通常的make。
我不确定发生了什么以及为什么。
到目前为止我尝试了什么:
1) 我唯一想到的就是尝试创建一个小示例应用程序并查看它是否运行,它实际上运行正常并且没有错误,如下所示:
08:16:00: Running steps for project untitled...
08:16:00: Configuration unchanged, skipping qmake step.
08:16:00: Starting: "/usr/bin/make" -j8
make: Nothing to be done for 'first'.
08:16:00: The process "/usr/bin/make" exited normally.
08:16:00: Elapsed time: 00:00.
我复制/粘贴的项目似乎使用snap,如果我创建一个新项目,如Qt Widget application,它实际上使用make,在输出中正确退出。
【问题讨论】:
-
@squareskittles,感谢您阅读我的问题。我知道问题出在哪里。谢谢建议,问题解决了。如果您发布您的答案,我可以将其标记为正确:) 再次感谢!
标签: c++ qt cmake qt5 qt-creator