【问题标题】:CMake, the c compiler unable to compile simple test programCMake,c编译器无法编译简单的测试程序
【发布时间】:2018-03-06 01:52:49
【问题描述】:

我正在尝试使用带有 mingw 的 cmake 编译我的项目,但出现错误:

     cmake -G "MinGW Makefiles" ../
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: D:/mingw/bin/gcc.exe
-- Check for working C compiler: D:/mingw/bin/gcc.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "D:/mingw/bin/gcc.exe" is not able to compile a simple test
  program.

问题出在哪里?

【问题讨论】:

  • 你的 gcc 版本是多少? gcc --version 来获取它。通常该错误是由于旧的 gcc 版本而发生的。
  • gcc (MinGW.org GCC-6.3.0-1) 6.3.0
  • 你能检查一下,看看是不是这样:stackoverflow.com/a/38786190/7735711
  • 仍然出现同样的错误
  • 我最后的希望是:stackoverflow.com/a/25995788/7735711 显然搞砸了 $PATH 也可以实现这个错误。如果没有,我不知道了。

标签: c++ mingw32


【解决方案1】:

有时,如果目录的名称中有空格,例如您在“程序文件”中的空格,就会出现问题。尝试将 sdk 复制到另一个没有空格的位置,看看会发生什么

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-18
    • 2017-11-16
    • 1970-01-01
    • 2021-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-13
    相关资源
    最近更新 更多