我在这里完全不知所措。
我有一个使用 CMake 的 C++ 项目。它曾经可以工作,但最近出现了一些奇怪的问题,所以我决定重新安装 Qt SDK 和 CMake。但是,现在尝试构建文件时出现以下错误:
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Qt/Qt5.0.1/Tools/MinGW/bin/gcc.exe" is not able to
compile a simple test program.
It fails with the following output:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
CMake Error: your C compiler: "C:/Qt/Qt5.0.1/Tools/MinGW/bin/gcc.exe" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "C:/Qt/Qt5.0.1/Tools/MinGW/bin/g++.exe" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
CMake Error: your C compiler: "C:/Qt/Qt5.0.1/Tools/MinGW/bin/gcc.exe" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/Qt/Qt5.0.1/Tools/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/Qt/Qt5.0.1/Tools/MinGW/bin/gcc.exe -- broken
-- Configuring incomplete, errors occurred!
这完全让我难以置信。MinGW 位于C:/Qt/Qt5.0.2/Tools/
,而不是Qt5.0.1
. 我在 CMakeLists.txt 文件中这样说:
SET(CMAKE_C_COMPILER C:/Qt/Qt5.0.2/Tools/MinGW/bin/gcc)
SET(CMAKE_CXX_COMPILER C:/Qt/Qt5.0.2/Tools/MinGW/bing++)
我什至添加C:/Qt/Qt5.0.2/Tools/MinGW/bin/
了全局PATH
变量,但这没有任何帮助。CMake 一直认为它应该在Qt5.0.1
- 一个不存在的文件夹中。
有人知道我可能会忽略什么选项吗?我几乎什么都试过了。