小さい頃はエラ呼吸

いつのまにやら肺で呼吸をしています。


Cppcheck cannot find all the include filesのエラーが出る場合の対処方法

はじめに

C++の静的コード解析ツールcppcheckを使っていて、Cppcheck cannot find all the include filesというエラーがでる場合は、INCLUDEファイルの場所を指定していないか、指定が誤っている可能性があります。

INCLUDEファイルのパスを指定する

cppcheckの-Iオプションで、INCLUDEファイルのパスを指定することができます。
以下の例では、同一階層のINCLUDEフォルダを指定しています。

cppcheck -I .\INCLUDE --enable=all hoge.cpp
-Iオプションの説明

Give path to search for include files. Give several -I parameters to give several paths.
First given path is searched for contained header files first.
If paths are relative to source files, this is not needed.