我是 oclint 的新手,试图让 0.8 版在 Virtualbox 中作为 VM 运行的 Ubuntu 14.04 桌面上运行。我是从源代码构建的,而不是使用二进制文件。
我有 2 个非常简单的程序。第一个是我编译的一个小型 cpp 程序:
gcc sample.cpp -o sample
我像这样运行 oclint
oclint sample.cpp -- -c
我得到一个文本报告。
我有另一个看起来像这样的objective-c程序
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog (@"hello world");
[pool drain];
return 0;
}
编译如下:
gcc -c hello.m `gnustep-config --objc-flags` -lobjc -lgnustep-base
这会产生一个有效的可执行文件。但是当我像这样遇到 lint 时,我遇到了问题
oclint hello.m -- -c
Compiler Errors:
(please be aware that these errors will prevent OCLint from analyzing this source code)
/usr/include/x86_64-linux-gnu/sys/param.h:23:10: 'stddef.h' file not found
OCLint Report
Summary: TotalFiles=0 FilesWithViolations=0 P1=0 P2=0 P3=0
[OCLint (http://oclint.org) v0.8.1]
我已经安装了许多库来解决丢失的 stddef.h 文件,包括 libc6 和 libc6-dev 都没有成功。我开始认为这是 oclint 运行方式的问题,但我太新了,无法快速弄清楚。我想让简单的例子工作,然后再转向更复杂的例子。