Visual Studio Code

Manish Chawda 431 Reputation points
2021-02-01T14:01:05.72+00:00

Hi,

I am new to Visual Studio Code and I am learning C programming. I am facing an error while compiling which says that I need to configure VS code for C11 / C99 mode. Kindly advise where to configure the same.

Also I am not able to debug. Kindly advise where to configure the same.

Also how to configure VS Code for C programming to compile with Windows debugger instead of GDB ?

How to configure VS Coed for C programming so that it used MSVC instead of GCC ?

Regards,

Manish Chawda

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,156 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Michael Taylor 55,301 Reputation points
    2021-02-01T15:20:50.367+00:00

    First you need to ensure that the C/C++ extension is installed which I assume you have already done.

    To configure most settings you have to edit the settings file. WIthin there you can configure the C standard to follow (C11/C99, etc), custom include paths, etc. That is fully documented here.

    To configure debugging simply press F5. If there is not yet a configured debugger it'll prompt you at the top. I'm not sure what is configured by default on your machine but the settings are stored in launch.json which is auto generated when you start debugging the first time. The options are defined here. Specifically to use the Windows debugger instead of GDB. Specifically you need to set the type setting to indicate the Win debugger (cppvsdbg).

    For MSVC++ vs GCC refer to this documentation here. As that documentation indicates the build settings are stored in tasks.json and c_cpp_properties.json. In newer versions you can open the files with the UI to make it easier to update.

    0 comments No comments

  2. Manish Chawda 431 Reputation points
    2021-02-03T12:52:15.46+00:00

    Hi,

    Thanks a lot for your reply.

    Yes I have installed C/C++ extension.
    For (C11/C99), I have gone the document but in that it is mentioned c_cpp_properties.json, while I had gone through File -> Preferences - Settings and find the below screenshot. Is it correct. C11 is already mentioned. Kindly find the attached screenshot and advise.

    Rest I am going through.

    Regards,

    Manish Chawda63521-capture.jpg63475-capture-1.jpg

    0 comments No comments

  3. Manish Chawda 431 Reputation points
    2021-02-03T13:03:05.903+00:00

    Hi,

    This is w.r.t configuring debugging. When I press F5 I get the attached screenshot.
    Also in output I receive the following error.

    "For C++ source files, the cppStandard was changed from "c++11" to "c++14" based on compiler args and querying compilerPath: "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe"

    Kindly advise.

    63552-capture-2.jpg

    63399-ss.pdf

    0 comments No comments

  4. Manish Chawda 431 Reputation points
    2021-02-03T13:06:51.433+00:00

    Hi,

    Attached is the launch.json. What I can understand is that for each .C file I need to mention the path for the file in launch.json, which I think is somewhat wired. Then also you are the expert and you can advise.

    Kindly advise.
    ![63514-image.png]1

    0 comments No comments

  5. Manish Chawda 431 Reputation points
    2021-02-03T13:09:30.57+00:00

    Hi,

    Is it a wise option to reinstall VS Code ?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.