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

前端 未结 7 538
野趣味
野趣味 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:34

    There is a much easier way to compile and run C code using GCC, no configuration needed:

    1. Install the Code Runner Extension
    2. Open your C code file in Text Editor, then use shortcut Ctrl+Alt+N, or press F1 and then select/type Run Code, or right click the Text Editor and then click Run Code in context menu, the code will be compiled and run, and the output will be shown in the Output Window.

    Moreover you could update the config in settings.json using different C compilers as you want, the default config for C is as below:

    "code-runner.executorMap": {
        "c": "gcc $fullFileName && ./a.out"
    }
    

提交回复
热议问题