Julia
Julia

Reputation: 69

compile_commands.json cannot be found

I've struggled with this for an hour now and would love some help. I'm trying to use the compile_commands.json file with vs code and the cpp extension. Below is my c_cpp_properties.json file and the compile_commands.json file.

c_cpp_properties.json

...
{
    "name": "Win32",
    "intelliSenseMode": "clang-x64",
    "includePath": [
        "${workspaceRoot}",
        "C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++",
        "C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/mingw32",
        "C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/backward",
        "C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include",
        "C:/MinGW/mingw64/include",
        "C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include-fixed"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "__GNUC__=6",
        "__cdecl=__attribute__((__cdecl__))"
    ],
    "compileCommands": "${workspaceFolder}/BlitzEngine/builds/Debug/compile_commands.json",
    "browse": {
        "path": [                    
            "C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include",
            "C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include-fixed",
            "C:/MinGW/mingw64/include"
        ],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
    }
}
...

compile_commands.json

[
{
  "directory": "C:/Users/Emburn/Documents/Projects/BlitzEngine/builds/Debug",
  "command": "C:\\MinGW\\mingw64\\bin\\g++.exe   @CMakeFiles/BlitzEngine.dir/includes_CXX.rsp -g   -o CMakeFiles\\BlitzEngine.dir\\src\\BlitzEngine.cpp.obj -c C:\\Users\\Emburn\\Documents\\Projects\\BlitzEngine\\src\\BlitzEngine.cpp",
  "file": "C:/Users/Emburn/Documents/Projects/BlitzEngine/src/BlitzEngine.cpp"
},
{
  "directory": "C:/Users/Emburn/Documents/Projects/BlitzEngine/builds/Debug",
  "command": "C:\\MinGW\\mingw64\\bin\\g++.exe   @CMakeFiles/BlitzEngine.dir/includes_CXX.rsp -g   -o CMakeFiles\\BlitzEngine.dir\\src\\main.cpp.obj -c C:\\Users\\Emburn\\Documents\\Projects\\BlitzEngine\\src\\main.cpp",
  "file": "C:/Users/Emburn/Documents/Projects/BlitzEngine/src/main.cpp"
},
{
  "directory": "C:/Users/Emburn/Documents/Projects/BlitzEngine/builds/Debug",
  "command": "C:\\MinGW\\mingw64\\bin\\g++.exe   @CMakeFiles/BlitzEngine.dir/includes_CXX.rsp -g   -o CMakeFiles\\BlitzEngine.dir\\src\\RenderWindow.cpp.obj -c C:\\Users\\Emburn\\Documents\\Projects\\BlitzEngine\\src\\RenderWindow.cpp",
  "file": "C:/Users/Emburn/Documents/Projects/BlitzEngine/src/RenderWindow.cpp"
}
]

I've tried using an absolute path without ${workspaceFolder} but that didn't work either and every time I save the file it just says

"${workspaceFolder}/BlitzEngine/builds/Debug/compile_commands.json"
could not be found. Using 'includePath'
setting in c_cpp_properties.json

My directory tree is as such:

Projects
+-- .vscode
|   +-- c_cpp_properties.json
+-- BlitzEngine
|   +-- Debug
|   |   +-- compile_commands.json
+-- include
|   +-- <header_files>
+-- src
|   +-- <source_files>

Thanks in advance for any help!

Upvotes: 4

Views: 11197

Answers (1)

Stephen Newell
Stephen Newell

Reputation: 7863

I don't see workspaceFolder listed in the c_cpp_properties.json documentation. The examples there use workspaceRoot, which you have earlier in your configuration.

Upvotes: 2

Related Questions