-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
I try to get use compile commands json, but I do not get it to work. I have included a minimal repro project files inline below.
Repro steps - case 1 - define:
- Open foo/main.c (and have no other files open)
- Hover mouse over RETURN_VALUE
- Right click and "Go to Definition"
Result I observe:
- Message "No definition found for 'RETURN_VALUE'"
Expected result:
- Editor opens bar/header.h
I also cannot use Go to Definition to navigate to the header file. If header.h is already open, then Go to Definition works.
- Extension Name: cpptools
- Extension Version: 0.15.0
- OS Version: Linux x64 4.13.0-37-generic
- VSCode version: 1.21.1
We have written the needed data into your clipboard. Please paste:
{
"activationTimes": {
"startup": false,
"codeLoadingTime": 123,
"activateCallTime": 7,
"activateResolvedTime": 526,
"activationEvent": "onLanguage:c"
}
}.vscode/c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"compileCommands": "${workspaceRoot}/compile_commands.json",
"includePath": [],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [],
"limitSymbolsToIncludedHeaders": false,
"databaseFilename": ""
}
}
],
"version": 3
}.vscode/settings.json:
{
"C_Cpp.intelliSenseEngine": "Default"
}compile_commands.json:
[
{
"directory": "foo",
"file": "main.c",
"arguments":
[
"/usb/bin/clang",
"-Ibar",
"foo/main.c"
],
"command": "/usr/bin/clang -Ibar foo/main.c"
}
]foo/main.c:
#include "header.h"
int main(int argc, char** argv)
{
return RETURN_VALUE;
}bar/header.h:
#define RETURN_VALUE (0)build.sh:
#!/bin/bash
clang -Ibar foo/main.cmika-fischer, defunctzombie, olifre, juxeii, natevm and 8 more