none
VS Code with CPP - command C_Cpp.ConfigurationEditJSON not found RRS feed

  • Question

  • I am trying to use VS code on my windows machine for c++ development (with WSL).

    Following the steps outlined in - https://code.visualstudio.com/docs/cpp/config-wsl

    While trying to create the configuration json, using Ctrl+Shift+P, "Edit Configurations":

    1. I don't see "Edit Configurations"

    2. Do see "Edit Configurations (JSON)" though which I believe should work similarly, but getting this error "command 'C_Cpp.ConfigurationEditJSON' not found".

    Can someone help?

    Thanks in advance.


    • Edited by akshsin Thursday, May 9, 2019 12:37 AM
    Thursday, May 9, 2019 12:36 AM

Answers

  • 1. Make sure to install C++ compilers such as mingw-w64. Here's a link for reference. https://code.visualstudio.com/docs/cpp/config-mingw

    Make sure that the debugger path is added in the windows environment path. In my case, mingw's debugger is in "C:\Program Files\mingw-w64\x86_64-8.1.0-win32-sjlj-rt_v6-rev0\mingw64\bin"

    2. In a command prompt type the following commands:

    mkdir projects
    cd projects
    mkdir helloworld
    cd helloworld
    code .

    3. Manually create 3 files in the "..\projects\helloworld\.vscode" folder.

    • c_cpp_properties.json
    • tasks.json
    • launch.json

    The content of each file is in the reference link above.

    4. c_cpp_properties.json

    Edit "compilerPath" to the debugger path to point to g++.exe file. In my case,

    "compilerPath": "C:/Program Files/mingw-w64/x86_64-8.1.0-win32-sjlj-rt_v6-rev0/mingw64/bin/g++.exe"

    5. launch.json

    Edit "miDebuggerPath" to the debugger path to point to gdb.exe. In my case,

    "miDebuggerPath": "C:/Program Files/mingw-w64/x86_64-8.1.0-win32-sjlj-rt_v6-rev0/mingw64/bin/gdb.exe"

    6. Add "helloworld.cpp" in the "..\projects\helloworld" folder.

    7. In the terminal tab at the bottom of Visual Studio Code, I navigated to the "..\projects\helloworld" folder.

    8. Click the debug icon on Visual Code's task bar. Make sure that the Play icon (green triangle) is pointing to (gdb) Launch.

    9. F5 or Click play

    • Marked as answer by akshsin Saturday, May 11, 2019 3:43 AM
    Thursday, May 9, 2019 7:33 AM

All replies

  • 1. Make sure to install C++ compilers such as mingw-w64. Here's a link for reference. https://code.visualstudio.com/docs/cpp/config-mingw

    Make sure that the debugger path is added in the windows environment path. In my case, mingw's debugger is in "C:\Program Files\mingw-w64\x86_64-8.1.0-win32-sjlj-rt_v6-rev0\mingw64\bin"

    2. In a command prompt type the following commands:

    mkdir projects
    cd projects
    mkdir helloworld
    cd helloworld
    code .

    3. Manually create 3 files in the "..\projects\helloworld\.vscode" folder.

    • c_cpp_properties.json
    • tasks.json
    • launch.json

    The content of each file is in the reference link above.

    4. c_cpp_properties.json

    Edit "compilerPath" to the debugger path to point to g++.exe file. In my case,

    "compilerPath": "C:/Program Files/mingw-w64/x86_64-8.1.0-win32-sjlj-rt_v6-rev0/mingw64/bin/g++.exe"

    5. launch.json

    Edit "miDebuggerPath" to the debugger path to point to gdb.exe. In my case,

    "miDebuggerPath": "C:/Program Files/mingw-w64/x86_64-8.1.0-win32-sjlj-rt_v6-rev0/mingw64/bin/gdb.exe"

    6. Add "helloworld.cpp" in the "..\projects\helloworld" folder.

    7. In the terminal tab at the bottom of Visual Studio Code, I navigated to the "..\projects\helloworld" folder.

    8. Click the debug icon on Visual Code's task bar. Make sure that the Play icon (green triangle) is pointing to (gdb) Launch.

    9. F5 or Click play

    • Marked as answer by akshsin Saturday, May 11, 2019 3:43 AM
    Thursday, May 9, 2019 7:33 AM
  • Since I was using WSL (and not a compiler on my windows machine), the steps were slightly different, but creating that .vscode directory and those 3 files manually was the key.

    It works now.

    Thanks.

    Saturday, May 11, 2019 3:45 AM