原文地址:http://blog.csdn.net/magicrobot/article/details/5583783
QA即question answer,用來解答是使用過程中遇到的問題:
1. Cannot open indirect file "c:/pclint/co-msc60.lnt"
現象: PC-lint for C/C++ (NT) Ver. 8.00e, Copyright Gimpel Software 1985-2001
:/pclint/std.lnt 3 Error 307: Can't open indirect file ' c:/pclint/co-msc60.lnt'
Tool returned code: 2
解決辦法:把 std.lnt 中每行前面的空格刪除,就 OK 了。
2. 將 pclint 放在任何目錄都是可以的,但是,如果是放在例如: Program Files 這樣的目錄中,由於該目錄中間有空格,所以,解析時常常會出錯,需要在絕對路徑外面加上引號,例如: "H:/Program Files/pclint/lint-nt.exe"
3. 使 pc-lint 的安裝路徑設定到系統地 path 環境變數中,那麼就完全可以使用相對路徑了
4. Can't open indirect file 'lib-ole.lnt'
現象:運行時,會提示 PC-lint for C/C++ (NT) Ver. 8.00e, Copyright Gimpel Software 1985-2001
c:/pclint/co-msc60.lnt(214) : Error 307: Can't open indirect file 'lib-ole.lnt'
Tool returned code: 2
解決辦法:開啟 co-msc60.lnt ,我們可以看到該檔案最後一行對 'lib-ole.lnt' 的調用,簡單的處理直接注釋掉就行了,如需用到 OLE, 請設定 lib-ole.lnt 的絕對路徑,並請參考下 pclint 的相關文檔)
5. C:/unix/usr/local/wbin/xargs: cannot fork
現象: C:/unix/usr/local/wbin/xargs: cannot fork
Tool returned code: 1
解決方案:查看下 xargs.exe 在不在目錄 C:/unix/usr/local/wbin/ 下;有關 xargs 的 Error Message 介紹,對"cannot fork" 是這麼解釋的: This normally happens if you use the -exec action or a something similar (-ok and so forth)
but the system has run out of free process slots. This is either because the system is very busy and the system has reached its maximum process limit, or because you have a resource limit in place and you've reached it. Check the system for runaway processes
(if ps still works). Some process slots are normally reserved for use by root. 據此分析肯定不是最大進程數的限制,但是受 resource limit 的啟發,覺得可能是某個程式沒能訪問到。然後仔細看 TOOL 的參數: commands: C:/unix/usr/local/wbin/find.exe arguments: $(FileDir) -name *.c -o -name *.cpp | C:/unix/usr/local/wbin/xargs
lint-nt -i"c:/unix/usr/local" -u c:/pclint/std.lnt c:/pclint/env-vc6.lnt 唯一沒有加絕對路徑的就是 lint-nt.exe 了,於是嘗試用 c:/pclint/lint-nt 替換原文中的 lint-nt , 即將custom command 中的命令修改為: commands: C:/unix/usr/local/wbin/find.exe arguments: $(FileDir) -name *.c -o -name *.cpp
| C:/unix/usr/local/wbin/xargs c:/pclint/lint-nt -i"c:/unix/usr/local" -u c:/pclint/std.lnt c:/pclint/env-vc6.lnt
6. 標頭檔引用失敗
解決辦法 : 開啟 pc- lint 安裝目錄下 std.lnt 檔案,在檔案尾以 ”-I ” 方式加上所需的標頭檔所在的路徑,如: -I C:/ISIPPC/diab/4.2b/include -IC:/Tornado/host/diab/include 再 運行 就可以查看查錯結果了。
7.303報錯
303 報錯屬於致命錯誤,可以使用 +macros 進行屏蔽,但是只能加到 pc-lint 的 執行命令裡才能解決,不能加到optional.lnt 檔案中。
+macros 可以使用多個,每多一個 +macros ,宏所佔用的空間就翻一倍