rashok
rashok

Reputation: 13464

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 errorcode
before the include statement. Please suggest me is there any way to suppress particualar headerfiles in std.lnt file.

Upvotes: 4

Views: 8517

Answers (2)

unwind
unwind

Reputation: 400029

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.

Upvotes: 1

Bill Evans at Mariposa
Bill Evans at Mariposa

Reputation: 3858

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)

Upvotes: 2

Related Questions