2011-04-21 47 views
4

我在我的项目中使用PC lint。我的项目兼容在Windows和Linux中构建。所以我在我的项目中使用了Windows头文件(visualstudio)文件和linux头文件(gcc)。我正在为所有文件运行pclint。它给错误消息如何在pclint中排除一些“无法打开包含文件* .h”错误

 
Unable to open include file *.h 

我不想抑制std.lnt文件这个错误,我不希望添加

-elint errorcode
之前包含语句。请建议我有什么方法来抑制std.lnt文件中的特定头文件。

回答

2

我假设你没有真正得到消息

Unable to open include file *.h 

但真的得到消息

Unable to open include file fred.h 

一些文件fred.h.

如果我是正确的,然后加上这两行std.lnt:

-efile(322,fred.h) 
-efile(7,fred.h) 
1

保护相关的包括与平台相关的预处理符号:

#if defined PLATFORM_PC 
#include <whatever/is/needed.h> 
#else if defined PLATFORM_POSIX 
#include <stdio.h> 
#endif 

然后确保你定义PLATFORM_PC当使用PC-Lint检查代码时,它不会看到它不理解的平台的包含。

相关问题