How to exclude some of the "unable to open include file *.h" errors in pclint
I am using PC lint in my project. My project is compatible to build in both windows and linux. So i have used windows header(visualstudio) files and linux header files(gcc) in my project. I am running pclint entirely for all the file. Its giving error message
Unable to open include file *.h
I dont want to suppress this error in std.lnt file and i dont want to add
-elint errorcodebefore the include statement. Please suggest m开发者_如何学编程e is there any way to suppress particualar headerfiles in std.lnt file.
I am assuming that you don't really get message
Unable to open include file *.h
but are really getting message
Unable to open include file fred.h
for some file fred.h.
If I am correct, then add these two lines to std.lnt:
-efile(322,fred.h)
-efile(7,fred.h)
Protect the relevant includes with platform-dependant preprocessor symbols:
#if defined PLATFORM_PC
#include <whatever/is/needed.h>
#else if defined PLATFORM_POSIX
#include <stdio.h>
#endif
Then make sure you define PLATFORM_PC
when checking the code with PC-Lint, so that it never sees the includes for the platform it doesn't understand.
精彩评论