我想使用 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 编译器,但失败了?
如果您需要有关设置的更多信息,请告诉我!
结果发现我的罪魁祸首是Windows Defender!将其关闭,CXX 编译器 ABI 信息 - 失败问题就消失了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)