pc-lint使用心得-QA

來源:互聯網
上載者:User

原文地址: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 ,宏所佔用的空間就翻一倍

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.