How does one set up the Visual Studio Code compiler/debugger to GCC?

前端 未结 7 547
野趣味
野趣味 2020-12-13 17:56

I am programming in C in Visual Studio Code, but I can\'t compile, as VSC only offers three compilers built in - Node.js, C# Mono, and Extension development. After a little

7条回答
  •  忘掉有多难
    2020-12-13 18:22

    For Windows:

    1. Install MinGW or Dev C++
    2. Open Environment Variables
    3. In System Variable select Path -> Edit -> New
    4. Copy this C:\Program Files (x86)\Dev-Cpp\MinGW64\bin to the New window. (If you have MinGW installed copy its /bin path).
    5. To check if you have added it successfully: Open CMD -> Type "gcc" and it should return: gcc: fatal error: no input files compilation terminated.
    6. Install C/C++ for Visual Studio Code && C/C++ Compile Run || Code Runner
    7. If you installed only C/C++ Compile Run extension you can compile your program using F6/F7
    8. If you installed the second extension you can compile your program using the button in the top bar.

    Screenshot: Hello World compiled in VS Code

提交回复
热议问题