开源软件名称:danmar/cppcheck开源软件地址:https://github.com/danmar/cppcheck开源编程语言:C++ 86.3%开源软件介绍:Cppcheck
About the nameThe original name of this program was "C++check", but it was later changed to "Cppcheck". Despite the name, Cppcheck is designed for both C and C++. ManualA manual is available online. Donate CPUCppcheck is a hobby project with limited resources. You can help us by donating CPU (1 core or as many as you like). It is simple:
The script will analyse debian source code and upload the results to a cppcheck server. We need these results both to improve Cppcheck and to detect regressions. You can stop the script whenever you like with Ctrl C. CompilingAny C++11 compiler should work. For compilers with partial C++11 support it may work. If your compiler has the C++11 features that are available in Visual Studio 2013 / GCC 4.8 then it will work. To build the GUI, you need Qt. When building the command line tool, PCRE is optional. It is used if you build with rules. There are multiple compilation choices:
cmakeExample, compiling Cppcheck with cmake: mkdir build
cd build
cmake ..
cmake --build . If you want to compile the GUI you can use the flag. -DBUILD_GUI=ON For rules support (requires pcre) use the flag. -DHAVE_RULES=ON For release builds it is recommended that you use: -DUSE_MATCHCOMPILER=ON Using cmake you can generate project files for Visual Studio,XCode,etc. qmakeYou can use the gui/gui.pro file to build the GUI. cd gui
qmake
make Visual StudioUse the cppcheck.sln file. The file is configured for Visual Studio 2019, but the platform toolset can be changed easily to older or newer versions. The solution contains platform targets for both x86 and x64. To compile with rules, select "Release-PCRE" or "Debug-PCRE" configuration. pcre.lib (pcre64.lib for x64 builds) and pcre.h are expected to be in /externals then. A current version of PCRE for Visual Studio can be obtained using vcpkg. Visual Studio (from command line)If you do not wish to use the Visual Studio IDE, you can compile cppcheck from the command line the following command. msbuild cppcheck.sln VS Code (on Windows)Install MSYS2 to get GNU toolchain with g++ and gdb (https://www.msys2.org/). Create a settings.json file in the .vscode folder with the following content (adjust path as necessary):
Run "make" in the terminal to build cppcheck. For debugging create a launch.json file in the .vscode folder with the following content, which covers configuration for debugging cppcheck and misra.py:
Qt Creator + MinGWThe PCRE dll is needed to build the CLI. It can be downloaded here: http://software-download.name/pcre-library-windows/ GNU makeSimple, unoptimized build (no dependencies): make The recommended release build is: make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" Flags:
g++ (for experts)If you just want to build Cppcheck without dependencies then you can use this command: g++ -o cppcheck -std=c++11 -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml2 -Iexternals/picojson -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml2/*.cpp If you want to use g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Ilib -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml2 cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml2/*.cpp MinGWmingw32-make If you encounter the following error with
Other Compiler/IDE
Cross compiling Win32 (CLI) version of Cppcheck in Linuxsudo apt-get install mingw32
make CXX=i586-mingw32msvc-g++ LDFLAGS="-lshlwapi" RDYNAMIC=""
mv cppcheck cppcheck.exe PackagesYou can install Cppcheck with yum/apt/brew/etc. The official rpms are built with these files: https://src.fedoraproject.org/rpms/cppcheck/tree/master Webpagehttps://cppcheck.sourceforge.io/ |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论