2011-04-21 49 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檢查代碼時,它不會看到它不理解的平臺的包含。

相關問題