windows - MinGW gcc 无法在 CLion 中编译简单的测试程序(与 cygwin 相同)

标签 windows compiler-errors path clion

我刚刚安装了 CLion,我需要编译器。我安装了 Cygwin。
但是出现了一个错误:

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in

CMake Error: Error executing cmake::LoadCache(). Aborting.

Error code: 1

因此,CMake 被“捆绑”了,我尝试从站点安装它。但是出现了下一个错误:
 Selected CMake might be incompatible with the Cygwin environment.
In order to run on Cygwin, CMake needs to be specially compiled.
Please select either CMake bundled with CLion or CMake from the Cygwin installation.


CMake Error: The source directory "/cygdrive/c/Users/Пользователь/AppData/Local/Temp/cmake_check_environment" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

Error code: 1

然后我尝试安装 MinGW - 这次是以下问题:
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe -- broken
CMake Error at D:/CLion 182.2574.4/bin/cmake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "D:/MinGW/mingw64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp

    Run Build Command:"D:/MinGW/mingw64/bin/mingw32-make.exe" "cmTC_a4ce5/fast"
    D:/MinGW/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_a4ce5.dir\build.make CMakeFiles/cmTC_a4ce5.dir/build
    mingw32-make.exe[1]: Entering directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj
    D:\MinGW\mingw64\bin\gcc.exe    -o CMakeFiles\cmTC_a4ce5.dir\testCCompiler.c.obj   -c C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
    gcc.exe: error: C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
    gcc.exe: fatal error: no input files
    compilation terminated.
    mingw32-make.exe[1]: *** [CMakeFiles\cmTC_a4ce5.dir\build.make:65: CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj] Error 1
    mingw32-make.exe[1]: Leaving directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
    mingw32-make.exe: *** [Makefile:125: cmTC_a4ce5/fast] Error 2




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".

Error code: 1

在这两种情况下, 都有问题。路径 , 我想。我试图给 CLion、gcc 等 root 权限 - 没有。
我试图找到日志或只是找到这条路径的方法 - 但一切都毫无值(value) - 路径不存在。我只是不知道为什么会这样。
请帮帮我

最佳答案

看起来 windows/cygwin/clion/cmake 之间的编码存在问题(我假设您的用户名是非 ascii)。

作为一种快速解决方法,请尝试:

  • 在没有非拉丁符号的位置安装 CLion
  • 更改 CLion 的 systemconfig文件夹到没有非拉丁符号的位置。 instructions

  • 为了解决问题,您能否检查一下 cygwin 的控制台是否正确显示了用户主路径? (例如,使用 ls /cygdrive/c/Users/ ,然后 cd 到用户主路径)。
    如果 Cygwin 可以与用户 home 一起正常工作,请问 file a bug report并附上 CLion 的日志文件? (帮助 | 在资源管理器中显示日志)

    关于windows - MinGW gcc 无法在 CLion 中编译简单的测试程序(与 cygwin 相同),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50551372/

    相关文章:

    windows - Batch/Powershell 多语言中的奇怪重定向

    vba - 类型不匹配错误-图表数据

    c++ - 使用 C++ 时,如果没有 gil 编译错误,则不允许调用需要 gil 的函数

    gradle - 有没有办法让gradle在$ path中执行命令行

    javascript - 将 Jquery 添加到我的服务器 (localhost) 中的根文件夹

    c# - 以独立于语言的方式检索性能计数器值

    windows - cmd 中 For 循环的属性列表

    c - USB HID 多点触控串行报告

    C - 动态内存字符串的不可寻址字节

    node.js - 如何在 Node.js 中获取没有完整路径的特定文件的目录名?