1
我從https://github.com/danmar/cppcheck/tree/1.77下載了zip文件,解壓縮並給出了一個make命令,它生成了cppcheck二進制文件。linux上的cppcheck安裝問題
接下來,當我在測試代碼上運行cppcheck時,不會生成錯誤。
sles12-box:/home/test/cppchecker_test/cppcheck-1.77 # cppcheck /home/demo_code/test_code.c
Checking /home/demo_code/test_code.c ...
的源代碼是
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
}
當我試圖使用在上面提到的頁,我得到以下錯誤
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
.
.
.
我試圖建立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.
如何獲得cppcheck設置準備就緒和功能?