pc-lint使用心得-QA

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

你可能感兴趣的:(其他)