I cannot get --include=<file> option to work. It seems that it is just silently ignored. Dumping preprocessed output with -E shows that specified file is not preincluded. Any advice?</file>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Apparently, cppcheck is case-sensitive when it comes to --include file names. Took me a good few hours to figure out. Would be nice to get an error message at least, when pre-include file could not be found.
Last edit: il--ya 2019-12-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just a short update:
"simplecpp" now issues an error when an explicitly included file can not be included.
I have created a PR that uses the new functionality from "simplecpp" so Cppcheck also exits with an error when "--include=" does not work.
Something like this is then issued by Cppcheck for example when "blah1.h" does not exist:
Thank you for this valuable feedback. I hope the error message is helpful now. If you have any other issues or ideas for Cppcheck do not hesitate to write about it.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In simplecpp I have not found a way to do this, in Cppcheck it is possible by simply using an empty string instead of the file name.
It would look like this then:
I cannot get --include=<file> option to work. It seems that it is just silently ignored. Dumping preprocessed output with -E shows that specified file is not preincluded. Any advice?</file>
Apparently, cppcheck is case-sensitive when it comes to --include file names. Took me a good few hours to figure out. Would be nice to get an error message at least, when pre-include file could not be found.
Last edit: il--ya 2019-12-02
I agree, this is not very user friendly.
IMHO it is an issue with
simplecpp
that is part of Cppcheck, so I created an issue there: https://github.com/danmar/simplecpp/issues/183Just a short update:
"simplecpp" now issues an error when an explicitly included file can not be included.
I have created a PR that uses the new functionality from "simplecpp" so Cppcheck also exits with an error when "--include=" does not work.
Something like this is then issued by Cppcheck for example when "blah1.h" does not exist:
Thank you for this valuable feedback. I hope the error message is helpful now. If you have any other issues or ideas for Cppcheck do not hesitate to write about it.
Hmm.. maybe it's unfortunate that the location points out code in a source file. I don't remember if we can give a "noloc" location.
In simplecpp I have not found a way to do this, in Cppcheck it is possible by simply using an empty string instead of the file name.
It would look like this then: