-
-
Notifications
You must be signed in to change notification settings - Fork 446
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
Hard to setup complex include paths for flycheck-clang projects #659
Comments
@stsquad The paths are not relative to the project root. That's documented, actually. You need to use absolute paths, ideally via Alternatively add a hook to C Mode which automatically computes the absolute include paths by resolving the relative paths against the project root (which you could obtain from Projectile, for instance), e.g. something like this:
I know that Clang supports “compilation database” files, which appear to be JSON files with flags that common build systems like CMake can generate, but I do not know how to make Clang load such databases, and I do not have the time to find out. I don't use C/C++. Pull requests welcome. For complex C/C++ packages, you may also want to look at Irony Mode and Flycheck Irony or similar extensions. I'm closing this issue, since it's more a question than a problem in Flycheck, and in any case not something that I'd fix, for said reasons. |
OK I'm getting there. You can build a compilation database with a tool called bear:
And then check any file using clang-check:
So I've started adding another flychecker type:
Unfortunately this falls over because flycheck has moved the file to be compile checked. Is there any way to suppress this? |
@stsquad |
@lunaryorn it took some finding, I figured it out from the source eventually. pull req incoming. |
@stsquad It's in the docstring of |
@lunaryorn it is, but I missed it from the flycheck-define-checker info. I'll have to re-read because something has gone wrong... |
I'd like to use the compilation database as well. I work with large codebases and can't list all include paths for flycheck. Does flycheck support the compile_commands.json format now? |
I'm trying to improve my use of flycheck-clang with QEMU. The problem is the build includes multiple target binaries and multiple source directories. I've tried manually adding include paths, e.g:
However this falls down as you go into sub-directories so the pathes need to be relative to the project root.
What would make this easier is if the clang checker supported a config file and then I could modify the the make system to spit out something useful for the particular thing I'm building.
The text was updated successfully, but these errors were encountered: