C++ cppcheck 找不到包含文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6986033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cppcheck can't find include files
提问by pic11
cppcheck can't find even standard headers such as iostream. Any ideas?
cppcheck 甚至找不到标准头文件,例如 iostream。有任何想法吗?
I am using Ubuntu 11.04 and cppcheck from the repository.
我正在使用存储库中的 Ubuntu 11.04 和 cppcheck。
回答by mcandre
cppcheck is really bad at finding standard include headers, on Mac and Linux. Fortunately, you can suppress this check, and only scan your custom header files:
在 Mac 和 Linux 上,cppcheck 在查找标准头文件方面非常糟糕。幸运的是,您可以取消此检查,只扫描您的自定义头文件:
cppcheck --enable=all --suppress=missingIncludeSystem .
回答by pic11
It isn't recommended to provide the paths to the standard C/C++ headers - Cppcheck has internal knowledge about ANSI C/C++ and it isn't recommended that this known functionality is redefined. But feel free to try it.
不建议提供标准 C/C++ 标头的路径 - Cppcheck 具有有关 ANSI C/C++ 的内部知识,不建议重新定义此已知功能。但请随意尝试。
-I [dir]
Give include path. Give several -I parameters to give several paths. First given path is checked first. If paths are relative to source files, this is not needed.
给出包含路径。给出几个 -I 参数来给出几个路径。首先检查第一个给定的路径。如果路径相对于源文件,则不需要。