我试图在VSCode上运行一个简单的Hello程序,在Windows 10上,测试事情是否进展顺利(我以前不得不重新安装操作系统)。这就是代码:
#include <stdio.h>
int main()
{
printf("Hello World!");
return 0;
}
应该很简单,而且应该运行得很好,我想。我在这些选择上试用了它,我认为它来自于Code Runner
(由军汉)扩展。当我尝试选择"Run“选项时,一切都运行良好,代码运行良好。然而,当我尝试"Debug C/C++ File“或"Run C/C++ File”选项时,这就是我所得到的。
* Executing task: C/C++: gcc.exe build active file
Starting build...
C:\Compilers\MinGW\bin\gcc.exe -fdiagnostics-color=always -g D:\Alfred\Studies\College\Skripsi\resources\preparations\CTest\HelloWorld.c -o D:\Alfred\Studies\College\Skripsi\resources\preparations\CTest\HelloWorld.exe
The system cannot find the path specified.
Build finished with error(s).
* The terminal process failed to launch (exit code: -1).
* Terminal will be reused by tasks, press any key to close it.
值得注意的是,在重新安装操作系统之前,C:\Compilers\MinGW\bin\gcc.exe
是系统路径中的MinGW目录。我不知道它为什么要这样做,考虑到:
gcc --version
命令,C:/MinGW/bin
),.vscode
文件夹和%APPDATA%中的Code
文件夹),但这个问题仍然存在。几个小时以来,我一直在寻找原因的可能性,但我还没有做到。希望你们中有人能告诉我我在这里忽略了什么。
P.S.:
C/C++
和韩军的Code Runner
。编辑1:我被告知这是由于微软的C/C++
扩展,而不是韩军的Code Runner
。我编辑了标题以反映这一点。
发布于 2022-08-18 13:14:09
您提到的两个选项来自微软的C/C++扩展:它们使用C_Cpp.default.compilerPath
设置来定位编译器。您可以更改它的设置、GUI或JSON文件中的设置。
https://stackoverflow.com/questions/73403667
复制相似问题