cppcheck找不到包含文件

时间:2022-12-17 15:07:11

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。

2 个解决方案

#1


21  

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 .

#2


14  

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参数以提供多个路径。首先检查第一个给定路径。如果路径相对于源文件,则不需要这样做。

#1


21  

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 .

#2


14  

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参数以提供多个路径。首先检查第一个给定路径。如果路径相对于源文件,则不需要这样做。