刚刚安装了QT,并试图在QTcreator内部使用Cmake而不是Qmake构建QT项目。
我得到以下错误:
Starting to parse CMake project, using: "DCMAKE_BUILD_TYPE:STRING=Debug",
"-DCMAKE_CXX_COMPILER:STRING=",
"-DCMAKE_C_COMPILER:STRING=",
"DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.13.1/msvc2015_64",
"DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.13.1/msvc2015_64/bin/qmake.exe".
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
Configuring incomplete, errors occurred!
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeOutput.log".
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeError.log".
CMake Deprecation Warning:
The 'cmake-server(7)' is deprecated. Please port clients to use the
'cmake-file-api(7)' instead.
CMake Project parsing failed.现在,如果我使用Cmake,那么在提供环境变量CMAKE_PREFIX_PATH之后,我可以成功地配置和生成项目文件。
但我无法让它在QTcreator内部工作。
任何人都有使用Cmake和QTcreator的经验,那么请提供帮助。
谢谢!
发布于 2019-09-12 06:22:34
错误消息显示您的C++编译器Visual 2015 (64位)无法定位。也许当您运行cmake时,它会找到另一个C++编译器,比如mingw?在Qtcreator的“设置”对话框中,有一个选项卡显示检测到的编译器,另一个选项卡显示可用的工具包。
发布于 2019-09-12 11:35:04
看来QtCreator正在使用cmake的不推荐版本。将QtCreator更新到一个新的(未发布的,编写此注释时,4.10.0版本就坏了)或将cmake降级为choco.exe install cmake --version 3.11 --force (更新的版本可能有效)。
还请确保安装jom (因为这是windows上QtCreator/CMake的默认设置)。
choco.exe install jom (我如何告诉它使用make?)
发布于 2019-10-03 17:28:02
反对警告是无害的。CMake现在反对cmake服务器,并为此提供了一个新的API。将支持4.11中的内容。
错误告诉您,CMake无法找到cl编译器。cl.exe随而来。确保在安装过程中在那里标记C++。默认情况下,它不再安装。
或者从Qt安装程序安装MinGW工具链。在Qt上下文中,它比Visual工具链更容易使用。
https://stackoverflow.com/questions/57897994
复制相似问题