【发布时间】:2022-01-13 21:43:52
【问题描述】:
尝试执行简单的 Hello World 程序时,我不断收到以下错误消息。
gcc: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
我已尝试卸载并重新安装 MSYS2 两次。我认为这可能与我设置的路径有关。我设置了以下路径:
C:\msys64\usr\bin
C:\msys64\mingw64\bin
当我尝试使用 C++ 运行 Hello world 程序时返回了类似的错误:
g++: fatal error: cannot execute 'cc1plus': CreateProcess: No such file or directory
compilation terminated.
【问题讨论】:
-
cc1通常不在 $PATH 中 - 相反,它存储在编译器知道的内部位置。在 Linux 上,它是/usr/lib/gcc/x86_64-linux-gnu/8/cc1(其中 8 是版本,您还必须至少替换三元组),如gcc -print-prog-name=cc1所见。您应该查看 cc1.exe 的实际位置与编译器认为的位置。 -
Process monitor 可以帮助您追踪 cc1 的预期位置。