-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to debug the include path search specified in c_cpp_properties.json
#13274
Comments
@raffaeler Can you try running the C/C++: Log Diagnostics command? The include paths reported there should match what is being used to resolve includes. |
Thanks for the prompt response @sean-mcmanus, I took some time to provide to distint answers on two different installations (both Ubuntu). Use-case1: ROS
|
Use-case 2: embedded development with Espressif / Arduino libraries.
|
The ROS use-case has issues on both the standard libraries (strlen not used directly but from a referenced library) and referenced libraries. They are all within the declared include paths and I expected that the Anyway the documentation does not specify if Please let me know if you need more data. Thanks |
@raffaeler If you have lots of files with conflicting names, it's likely that your include path ordering doesn't match what you need to compile. Using |
@sean-mcmanus in the ROS use-case, there is no manual intervention on the The 2nd use-case does not have this short paths but it never works and still can't understand why as I followed each error without understanding the reasons. I am wondering why you don't use the debug procedure to create the c_cpp_properties. Basically you can run a working compilation, grab the include paths used by the compiler and create the c_cpp_properties.json with those path. Shouldn't it work correctly? |
@sean-mcmanus I deleted the relevant part of the
|
@raffaeler What do you mean by "it has been created automatically by the package creation"? Who is creating it? What does the "debug procedure" mean?
I don't know what the If you run the equivalent commands with g++ does it compile (ignoring any linker issues which shouldn't matter)? e.g.
You could try something similar with other commands lines (those are just the 1st two you posted). Or checking what is being sent to g++ to compile and changing the includePath or other args to match. If you use a configurationProvider like CMake Tools or Makefile Tools is should send the equivalent args used for compilation (similarly with compile_commands.json). |
It was scaffolded by some ROS tool, I am not sure which one.
Since comments are not supported in JSON, I use not-existent keys to temporarily park unused entries.
In the ROS use-case, there is a quite complex makefile created by CMake. In the other use-case I can see the compilation log, which is extremely long. Couldn't the extension grab the compilation output and create the entries automatically? Beyond that, in my last comment I could verify that an include file is indeed in the path but it is not found in the Intellisense. |
@raffaeler Have you tried configuring with the CMake Tools extension by setting The Go to Definition feature uses the database for definitions outside of the TU, so Go to Definition could open the file even if the opened file is not being used by IntelliSense for the current TU. |
I didn't. I will see how to do that, because typically on ROS you launch the CMake in a script with many other steps. I am not sure if using the extension is easy to do.
At this point I am lost. Understanding the reasons of the Intellisense not working is far too complex and it is not worth the time to spend. Sadly I'll have to turn it off. |
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
I am following the reference page: https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference
Anyway, there are many cases where the include are not found even if the files are found in the provided paths
Of course, the code compiles successfully.
The compiler is:
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
How can I visualize all the paths where the definitions are searched?
How can I "debug" the search paths?
Configuration and Logs
Other Extensions
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: