User forums > Using Code::Blocks

I have installed CppCheck but get an error when I try to run it in.

(1/3) > >>

Dice:
I'm using Code::Blocks 13.12 with MinGW -w64 (TDM-GCC suite) compiler on Windows 7 (64bit).  My goal is to use CppCheck to help me find memory leaks in my programs.  I downloaded the 64-bit version of CppCheck from here: http://cppcheck.sourceforge.net/.  I then installed CppCheck from the installer.  Next I opened Code::Blocks and went to --> Settings --> Environment --> CppCheck.  In the field labeled "CppCheck application:" I clicked "..." and went to the place where CppCheck was installed and selected "cppcheck.exe".  I then opened up a project that I'm working on, built it using "Debug", and went to --> Plugins --> CppCheck.  I then get an error message that says "The program can't start because MSVCP140.dll is missing from your computer.  Try reinstalling the program to fix this problem."  I click "OK" and the same message pops up again.  I then get another popup that says "Failed to parse cppcheck XML file.  Probably it's not produced correctly."  I checked the directory where CppCheck is installed and I didn't see "MSVCP140.dll".  I then checked the folders where my compiler is installed and didn't see "MSVCP140.dll".  I then did a google search for "MSVCP140.dll" and found some results saying that I need to get this run-time library by downloading Visual Studio.  I didn't download Visual Studio because I'd rather use Code::Blocks.  Has anyone else had this issue?  How can I get CppCheck to work?  Does Code::Blocks have another plugin option to check for memory leaks on Windows builds?

raynebc:
You don't have to install the entire Visual Studio suite, just the VC++ runtime:
https://www.microsoft.com/en-us/download/details.aspx?id=48145

MortenMacFly:

--- Quote from: raynebc on January 16, 2016, 10:13:55 am ---You don't have to install the entire Visual Studio suite, just the VC++ runtime:
https://www.microsoft.com/en-us/download/details.aspx?id=48145

--- End quote ---

It is very simple: If you install the 32 bit version of CppCheck these DLL's are included. If you install the 64 bit they are missing (probably for a good reason). Now, for Cppcheck to find these DLL's when called from another folder (or tool, like C::B), you'll need to add the path to the CppCheck folder to...
- either you Windows PATH environment, or
- use the envvars plugin to extend the PATH environment for the focus inside C::B or
- add the path to the CppCheck folder (with the DLL's included) to the compiler path's as this:
Settings -> Compiler -> [Your compiler] -> Toolchain executables -> Tab "Additonal paths"

(For the latter to work it maybe required to run the compiler first.... so that is the worst option.)

Goofus Maximus:
I ended up just downloading the source code zip file.  They have a codeblocks project file included in it, so I just unzipped, opened the cbp file and compiled the project with my default TDM Mingw W64 compiler, then pointed the cppcheck path to that folder.

I don't have a fancy GUI, but it works with codeblocks...

Edit: and for some reason, this self-compiled cppcheck loves to say "too many configs".  I ended up downloading the 32 bit version, since codeblocks is 32 bit as well, and this version goes into great detail about just what all is wrong with WX code, just from the simple "new wxWidgets project" template code, so it's working just fine.

Edit of the edit:  Okay, I admit I am an idiot.  Can someone give a more intuitive example of how to restrict ifdef hell to just what the compiler is currently using?  The manual is lacking in real-world examples of command line usage...

Dice:
Thanks for the help everyone.  This is getting more complicated than I'm comfortable with.  I think I'll just end up writing a wrapper for malloc() and free() to look for memory leaks.

Navigation

[0] Message Index

[#] Next page

Go to full version