在 Visual Studio Code 中进行 C 编译

标签 c compiler-errors compilation visual-studio-code

当我尝试运行我的 Hello World 项目时,VSC 告诉我:

[Running] cd "c:\Users\frase\Desktop\test\" && gcc main.c -o main && "c:\Users\frase\Desktop\test\"main Der Befehl "gcc" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

我安装了 Coderunner 和 C/C++ 扩展等等

Screenshot

我是否需要在某处指定编译器的路径或者我做错了什么?

我很感谢您的帮助。 问候

最佳答案

您是否遵循了所有这些步骤? https://code.visualstudio.com/docs/languages/cpp

Note: The C/C++ extension does not include a C++ compiler or debugger. You will need to install these tools or use those already installed on your computer. Popular C++ compilers are mingw-w64 for Windows, Clang for XCode for macOS, and GCC on Linux. Make sure your compiler executable is in your platform path so the extension can find it. The extension also supports the Windows Subsystem for Linux.

我建议使用其他C语言编程软件来入门,例如Codeblocks (预装了 mingw)。

关于在 Visual Studio Code 中进行 C 编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54968015/

相关文章:

c - 使用循环将 Char 值添加到链接列表 [C]

c - 在这种情况下最好使用哪种流程

c - 错误 : expected '=' , ','、 ';'、 'asm' 或 '__attribute__' 之前的 'void'

c++ - constexpr函数: gcc/msvc vs clang/icc [duplicate]的const引用参数

c++ - 不断收到错误: expected unqualified id at end of input- C++

c++ - 将源文件拆分为cpp和h后无法编译项目,得到 "undefined refernce to..."

xml - R 上包 ‘XML’ 的编译失败

c - C [ void * ] 中的通用数据类型

c++ - 我可以在没有 qmake 或 Qt Creator 的情况下使用 Qt 吗?

c - 将二维指针数组传递给函数给出错误