Skip to content

Differences in .clangd vs compile_commands.json in determining the path to the system headers #1985

Answered by i-ky
palapapa asked this question in Q&A
Discussion options

You must be logged in to vote

How do they affect each other in regards to determining the include paths?

I believe that Compiler from .clangd file can override the compiler executable specified in compile_commands.json. This may be useful if, for example, "real" compiler from compile_commands.json does not behave like GCC or clang, has implicit defines, etc. Compiler allows you to point clangd to a script that will fake the compiler output so that clangd can extract include paths, defines, etc.

In general, how do .clangd and compile_commands.json differ? Why wouldn't I always use .clangd to configure clangd?

The biggest difference is that compile_commands.json is typically generated by build system (e.g. CMake) or…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HighCommander4
Comment options

Answer selected by palapapa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants