加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 在Windows 10上使用mingw进行CMake:检测CXX编译器ABI信息

发布时间:2020-12-16 07:22:35 所属栏目:百科 来源:网络整理
导读:我想使用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.
我想使用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信息 – 失败的问题消失了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读