【发布时间】:2018-01-07 21:01:12
【问题描述】:
我想使用 cmake 在 Windows 10 上创建 MinGW Makefile。我已经安装了 mingw,我可以毫无问题地使用 mingw32-make 和 g++ 命令。
测试项目是一个超级简单的CMakeLists.txt文件:
cmake_minimum_required(VERSION 3.10)
project(hello-world)
add_executable(hello-world main.cpp)
还有一个简单的 main.cpp 文件:
#include <iostream>
int main() {
std::cout << "hello Visual Studio Code! :)" << '\n';
return 0;
}
这些是我用来创建 makefile 的命令:
>> mkdir build
>> cd build
>> cmake -G "MinGW Makefiles" ..
这是我得到错误的地方:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.10/Modules/CMakeDetermineCompilerId.cmake:495 (file):
file STRINGS file
"C:/Projects/test/build/CMakeFiles/3.10.1/CompilerIdCXX/a.exe" cannot be read.
... some more errors in the test files
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring incomplete, errors occurred!
这是来自错误日志:
The CXX compiler identification could not be found in "C:/Projects/test/build/CMakeFiles/3.10.1/CompilerIdCXX/a.exe"
什么是 CXX 编译器 ABI 信息,如何检测到工作的 CXX 编译器但失败?
如果您需要有关设置的更多信息,请告诉我!
【问题讨论】:
-
第一个错误之后的错误可能是由第一个错误引起的 - 看起来像是缺少或错误的构建链组件。
标签: c++ cmake windows-10 mingw