简体   繁体   English

cppcheck 关于 linux 设置问题

[英]cppcheck on linux setup issue

I downloaded the zip file from https://github.com/danmar/cppcheck/tree/1.77 , unzipped it and gave a make command which generated cppcheck binary.我从https://github.com/danmar/cppcheck/tree/1.77下载了 zip 文件,解压并给出了一个生成 cppcheck 二进制文件的 make 命令。

Next when I run the cppcheck on a test code no error is generated.接下来,当我在测试代码上运行 cppcheck 时,不会生成错误。

sles12-box:/home/test/cppchecker_test/cppcheck-1.77 # cppcheck /home/demo_code/test_code.c 
Checking /home/demo_code/test_code.c ...

The source code is源代码是

sles12-box:/home/test/cppchecker_test/cppcheck-1.77 # vi  /home/demo_code/test_code.c
main(int argc, char* argv[])
{
        char cobj[7] = "yahoo";
        char    *cobjPtr = cobj;
        int iobj = 4;

        printf("###########################     CPPCHECK TEST   ############################\n");
      yahoo

}

When I tried to compile using the other build command specified in the above mentioned page I get below error当我尝试使用上述页面中指定的其他构建命令进行编译时,出现以下错误

sles12-box:/home/test/cppchecker_test/cppcheck-1.77 # make SRCDIR=build CFGDIR=cfg HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function"

make: pcre-config: Command not found
g++ -Ilib -Iexternals/simplecpp -Iexternals/tinyxml  -DCFGDIR=\"cfg\" -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -std=c++0x -DHAVE_RULES -DTIXML_USE_STL   -c -o build/analyzerinfo.o build/analyzerinfo.cpp
make: pcre-config: Command not found
g++ -Ilib -Iexternals/simplecpp -Iexternals/tinyxml  -DCFGDIR=\"cfg\" -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -std=c++0x -DHAVE_RULES -DTIXML_USE_STL   -c -o build/astutils.o build/astutils.cpp
make: pcre-config: Command not found
g++ -Ilib -Iexternals/simplecpp -Iexternals/tinyxml  -DCFGDIR=\"cfg\" -O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -std=c++0x -DHAVE_RULES -DTIXML_USE_STL   -c -o build/check.o build/check.cpp
make: pcre-config: Command not found
.
.
.

I tried building the cppcheck 1.76 version but I get different error there:我尝试构建 cppcheck 1.76 版本,但在那里出现不同的错误:

sles12-box:/home/test/cppchecker_test/1.76/cppcheck-1.76.1 # sudo make install
Makefile:88: Extraneous text after `else' directive
Makefile:90: Extraneous text after `else' directive
Makefile:90: *** only one `else' per conditional.  Stop.

How to get the cppcheck setup ready and functional?如何准备好 cppcheck 设置并使其正常运行?

Did you try to install the binary package?您是否尝试安装二进制包? https://software.opensuse.org/package/cppcheck https://software.opensuse.org/package/cppcheck

re 1.77: pcre-config is part of the pcre package (most likely the development package re 1.77:pcre-config 是 pcre 包的一部分(很可能是开发包

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM