CppChecker Eclipse Plug-in
This Plugin is still Beta, but it already works.
I use it myself at work and I try to improve it continually.
Comments and suggestions are highly appreciated!
CppChecker is a smart and fast checker for C/C++ Files. It uses the outputs generated by gcc, PC-Lint or doxygen and generates markers. The markers are intuitively set, so that in most cases the marker corresponds to the location where the actual error or warning appears. Also a resolution is added - is it is known from JDT - in cases a solution was implemented or exists.
CppChecker is however not intended as total replacement for CDT. Only the marker placement and the contained messages will be improved. Other important features of CDT, as outlining the C/C++-Files, Call-Hierarchie,... will not be affected by this plugin. A special focus is on the use with "incremental builds", i.e. parsing the currently edited and saved file(s) and the depending files immediately.
The update site for the CppChecker is www.jaylib.org/cppchecker, the update site for the test versions, is www.jaylib.org/cppchecker/test. The test version however ist not stable. So this is really for people, who want to try the newest version.
The current version is 0.9.9.2.
Here are some points that I still miss before doing the "big step" to 1.0.0:
- Restart builder on save rather than hanging until the build from the previous save has finished - this is rather an eclipse issue, but I'll probably fix it by calling an own implementation of the builder. I'm totally unsatisfied the way the builder is working with Eclipse/CDT. -- done
- A more accurate progress bar - this could depend on the previous point
- Export and Import of the settings as XML document supporting relative paths (so the settings and the project could be shared) -- done
- an FAQ section (especially for those having problems with includes
) and a HOWTO section here on this site, containing flash anmiations with demonstrations how to configure and work with CppChecker.
- and some small points, like starting single tests (instead of whole suites) -- done, integration of doxywizard (if possible) -- done, ...
- and maybe still some fixes and enhancements -- done (some)
Installation << For Download and Installation instructions see here.
Tutorials << made with wink - Flash needed
Installation << Installation Tutorial NEW
Configuration << Configuration Tutorial NEW
Doxygen << Doxygen Tutorial NEW
PC-Lint << PC-Lint Tutorial NEW
GCC support << Marker generation from gcc-output and other supported features are described here.
PC-Lint support << If you use PC-Lint and Eclipse, you probably want to check the features here.
Doxygen support << Creation of doxygen documentation and update of changed files.
CppUnit support << Marker generation for failed unit tests.
Planned support << Other supported programs and/or features are described here.
Screenshots
JavaDoc << the old style documentation
DoxyGen << new doxygen documentation - lacks some rework
28.02.2011 - 08:46
Michael: A General comment
Please - really really - use the "Report a Bug", "Get Support" etc. links. Please also keep in mind, what you - as a developer - would like to know, when someone else is reporting a bug to you. "Does not work" won't probably do it... So: what exactly is the problem and which parser(s) are you using. There is a bunch of them and they are all different! Also needed: Eclipse version + Operating System.
There is currently a test-version 0.9.9.7 available at www.jaylib.org/cppchecker/test It fixes a lot of issues - also file-suffixes (as configured in CDT-Preferences/File Types) are supported.
I still have to work on the (Alt-U/)Check with CppChecker - Feature - it currently does not work with single files. Also: when there is nothing to check, give a better error message (file(s) not on source path or file type not configured to be C/C++).
07.01.2011 - 08:00
Martin: Project properties
The import/export from CDT is not usable for me. I have a lot of settings made in the CDT. If i import them to the CppChecker, CppChecker doesn't work! i have to strip done them every time!
07.01.2011 - 07:54
Martin: Window Preferences
It's not usable to have the preferences stored in the workspace. By creating a new workspace the general configurations are lost. I don't wona to that every time i create a new workspace! Tools i now: DoxyGen, Klocwork, Cantata, Rhapsody, CVS, etc.
04.01.2011 - 11:46
Rob: Using PC-Lint with Subfolders
Hi,
In my project I have subfolders that contain some of my code. At the moment, PC-Lint/CPP Checker does not examine these files. I know that PC-Lint does not support recursion of subfolders (see item 3 on their FAQ - http://www.gimpel.com/html/techfaq2.htm#q3). Can CPP Checker be made to pass these files through PC-Lint.
Thanks in advance,
Rob
14.12.2010 - 07:11
Michael: ...
@SomeOne (great name by the way): OK, seems the sources/header filter should be added in a dialog. Maybe on the general page (as it supposedly does not depend on the compiler/checker-tool)
@Martin For the Window/Preferences: I don't know of any tool that does it the way you mentioned. Do you know of such a tool? To the other "request": Try using the export to CDT/Import from CDT-feature on the PC-Lint settings page - if you don't use other settings in your CDT environment. This overwrites the settings (includes, defines, undefines) of your CDT. When you import this project to another workspace, you'll simply have to "Import the Settings from CDT" again. CppChecker is however not part of the CDT and not part of the .cproject...
25.11.2010 - 03:15
Martin: Project properties
Hi, in a project i activate the PC-Lint Checker in the CppChecker settings and set my own options for lint. This configuration is stored some where in the workspace. if i import now this project in an other workspace this configuration is lost. An export to the CDT saves only the include pathes but not my own Lint options. The CppChecker settings shoud be stored in the file .cproject!
25.11.2010 - 02:08
Martin: Window Preferences
Hi, i made a default configuration under "Window\Preferences\CppChecker\PC-Lint Settings" for the CppChecker. This configuration is stored some where in the workspace. By changing the workspace i loose this configuration. The configuration shoud be stored in eclipse environment!
24.11.2010 - 12:53
SomeOne: Re: "no files to check in call to checkResources!"
Michael,
that file suffix issue may be the problem. Related projects use .csl for C source code. Some configuration option would help (at least to iron out that idea).
31.08.2010 - 06:16
Conni: No Builder in Windows -> Preferences...
I have also the problem that there is no builder entry in Windows -> Preferences in Eclipse (Version Galileo 3.5)
Is there any known reason for this?
23.07.2010 - 09:47
Tom: No Builder
I have the same prob as Fredinsky, anybody any idea?
29.06.2010 - 08:12
Free: Forcing PC-Lint check for single file?
Would it be possible to integrate hotkey assignment for a PC-Lint call: "check this single file" (should be the "-u" parameter for lint-nt)? Incremental build support does not quite fit (and we can only use external builders with full builds anyways). Michael: Phoo - well, maybe adding a hotkey for checking only the currently opened/active file and/or a hotkey for checking the currently active tree/node in the explorer view. Unfortunately there is no easy way to invoke a parser with only just a parameter (normally it's not only this parameter but also a bunch of others). The solution could be that the -u parameter is added to the settings and a build on a single file is invoked using a hotkey. Is the -u parameter necessary anyway and why wouldn't an automatic build with Incremental build not work? What would be the difference using -u - I don't quite understand.
28.06.2010 - 07:14
Fredinsky: No Builder
Hi, I'm trying to use CppChecker plugins. I followed all installation steps and everything finished well. But during the configuration steps, I have no CppChecker Builder under the Builder tab. However I have the CppChecker Setings tab. Do you have any idea to fix this ?? Thanks
Michael: Hi, well - if you activated the plugin itself and also one of the parsers it should show up within the builders - maybe after restarting eclipse? If not - please report a bug (via sourceforge) - it's a bit tedious keeping the conversation using the comments-box...
28.06.2010 - 06:02
Fredinsky: No Builder
Hi, I'm trying to use CppChecker plugins. I followed all installation steps and everything finished well. But during the configuration steps, I have no CppChecker Builder under the Builder tab. However I have the CppChecker Setings tab. Do you have any idea to fix this ?? Thanks
17.06.2010 - 06:24
Roberto: error
Hi, i'm using 9.9.5 version (only PClint and doxygen). I obtain the following error
error starting lint, got: PC-lint for C/C++ (NT) Ver. 8.00p, Copyright Gimpel Software 1985-2004 expected: .*Vers. [7-9].[0-9][0-9][a-z].*...
8.00p is in the range [7-9].[0-9][0-9][a-z].... what is the reason of the error?
Thank you
Michael: Hi Roberto, that's only just a warning, that the version could be wrong... here the pattern "Ver." and "Vers." don't seem to match. I adjusted that. Thanks.
17.05.2010 - 03:54
Ronald: Files excluded from the build are not excluded.
First of all, great plug-in!
Using CppChecker version 0.9.7.5
Problem description: I'm using "Sourcery G++" from CodeSourcery which is based on the Eclipse Platform v3.5.0 and CDT v6.0.0. I'd like to use your plug-in but unfortunately the files excluded from the build are not excluded by the CppChecker. I'm not sure the cause of the problem is the combination of Sourcery G++ and CppChecker, but I also tried CppChecker with the new Xilinx SDK v12.1 which is also based on Eclipse with the same result; excluded files are parsed by CppChecker. I've tried to check and unckeck the "Excluded files from CDT" option without success. I'm using linked resources in my project, but this doesn't seems to be the problem because I've tried the same source-files as non-linked-resource without success. I hope you know what I can do to make this work and if you need any more information or whatever just let me know.
Thanks in advance,
Ronald
28.04.2010 - 12:13
SomeOne: How to fix "no files to check in call to checkResources!" in the cppchecker console?
I have one Eclipse project which works with cppchecker(for PCLint) more or less as expected (cppchecker runs PCLint after a file change has been committed to disk; Lint markers placed accordingly). For the other Eclipse projects I constantly see the "no files to check in call to checkResources!" message although files are being modified and project is rebuilt by CDT. As a result none of the changed files are checked and no markers show up.
What needs to be set/in place/avoided for cppchecker to correctly recognise changed files ? Can I use resources linked into the workspace ?
Thanks.
Michael: linked resources can be used. What file-suffixes (such as cpp, cxx, etc.) do you use? Maybe that's the problem - normally all files that are added as source-files (i.e. all files in source directories) should be parsed, but currently only - *.c|C|cpp|CPP|cc|CC|cxx|CXX - files. If that's a problem, I could / maybe should make that setting configurable.
28.04.2010 - 11:28
SomeOne: cppchecker(PCLint) not triggered by "Build Selected File(s)" ?
I may have missed something but there seems to be no way to run cppchecker(for PCLint) with Eclipse option Project->Build Automatically off. It would be nice to have a single file checked during the "Build Selected File(s)" process (e.g. from C/C++ Projects view).
14.04.2010 - 12:16
Russ Taylor: Gcc Problem: Missing implicit include: int" / ...long / ... unsigned
Hi Michael,
I am using FlexeLint on Ubuntu / gcc 4.4.1. FlexeLint issues are resolved, thanks to instructions below in response to GroovyD's question. However, I just cannot figure out "missing implicit include" issues flagged as a gcc problem. I configured CppChechker as in the demo.
I am not sure if it is a configuration mistake or a bug.
Thanks for your help,
Russ
06.04.2010 - 17:28
Russ Taylor: thanks.
Hi Michael,
great job. tutorials are terrific. thanks for all the work.
Russ
21.03.2010 - 13:35
Michael: Re: Doxygen view empty
Hi Ron,
I don't know about the problem actually. If you'd check the following things or watch the doxygen tutorial, it might work: - try pressing Shift-F1 on an element in your code. If the internal browser can't find the documentation a dialog is shown. However, if the external browser is opened with Shift-F2, this probably won't solve the problem. - Alternatively: is the button with the two arrows in the doxygen view activated? - Do you use your own doxygen settings or the predefined settings? - Does the output directory in the cppchecker settings fit to the real output directory of the documentation? - Browser-Settings: maybe it will only work with Firefox 3.x? Try setting the Browser in the Windows/Preferences/CppUnit-Settings. - you can contact me via the sourceforge site (see links "Report a Bug" or "Get Support" above)
Best regards
Michael
10.03.2010 - 06:59
Ron: Doxygen view empty
Hi Michael,
The plugin seems to be working fine when using the doxygen parser - tool gets called and files are generated. However, the doxygen view remains empty. I can look at the generated HTML in the browser, though. Might it be possible that the view either doesn't get updated or doesn't find the html file it is looking for? For example, output for a class Sap is the file Sap_8h.html, which contains the appropriate doc. Am I missing some config setting here?
I'm using doxygen 1.5.6 on ubuntu linux.
Thanks for your efforts and keep up the good work, Ron
17.02.2010 - 13:20
Michael: ...
@Frank No, you see that correctly. There is no such feature - yet. It should not be that difficult to implement, I think. I intended to add a view to start each builder separately. That's a TODO then... At the moment there's only the possibility to do this with the doxygen and the cppunit builder. It's included in the according views. One other thing I'd like to add is - kind of - a batch or make mode for the command. That is, not the compile command, but the make command is given.
@Arne there is only one possibility for that at the moment - this is a CDT feature actually: you can right click on an element (path/file) in the project explorer and select "Exclude from Build" and select the configuration to exclude it from.
Hm - maybe I could add a context sensitive menu myself - and add the activated parsers as subfolders - like
+ CppChecker
+ PcLint
+ Gcc
+ VC++
Now - what about that?
10.02.2010 - 06:42
Frank: Manually start a CppChecker Build
Hi, I really like this great plugin. One feature I would like to see, is the possibility to manually start a check instead of doing it automatically with each build, or is it already there and I don't see it?
09.02.2010 - 04:01
Arne: Linting subfolders only
Hi, CppChecker is a great plugin, but I am missing one feature. I have many source subfolders, and want to be able to only lint one subfolder or just one file and get the lint errors/warnings from the specific folder/file displayed in the problem window. Is that possible?
04.11.2009 - 15:32
Michael: some answers
@Martin no support for splint planned (any more)
@Hermann OK, I started with a small installation tutorial - also see the comments below, if you don't get it working
@tal ...
if it's a bug, you might want to use "Report a Bug" and you probably would get an answer (even earlier)
check the following things:
- Project - Build automatically -> Tick set?
-- rest in Project - Properties: - Builders: Tick set for CppChecker Builder?
- C/C++-General / Paths and Symbols / Source Location: all source paths (and exclusion filters) have to be added here.
- CppChecker-Settings - General Tab: Full Build support + Incremental Build support set?
- " - Gcc Settings Tab: is there such a tab and is the gcc parser installed?
- " - Gcc Settings Tab: correct path to gcc?
- " - Trace Settings: Try to activate log output: Trace-Level: Info, Trace Parser, Write to Console
- also watch out, if there is a warning symbol on the project root -> Messages in "Window - Show View - Problems"
still not running? Write a bug report! And please don't forget to mention the gcc version and the operating system you're using.
30.10.2009 - 06:02
Martin: splint
Anybody have a solution for splint?
29.10.2009 - 16:03
Hermann: How to...
CppChecker seems to be the solution for all of my problems, however I don't have any clue how to use it! Could somebody be so nice to explain in detail how to invoke the tool?
07.09.2009 - 09:55
tal: a question
Hi! I'm not sure what this plugin does.. I have to have gcc, PC-Lint or doxygen installed in order for it to work? also, I checked the "Generate output" option in the GCC settings tab, and nothing happens whan I compile. is it supposed to print some kind of output file? thanks!
09.06.2009 - 10:06
Michael: Guideline coming up...
Sorry, I'm currently on holiday and did not have much time before. The lnt-Files (including the complete path on the system) can be added as option to the CppChecker Properties on the PCLint Property Page. As to the lint output - The main purpose of this plugin is to show and mark the messages directly in the editor. Other output is not planned (at the moment).
06.06.2009 - 12:04
Daniel: Guideline needed
Hello, its great to have such a tool with this flexibility, nevertheless A short guideline how to integrate e.g. PC-Lint into the Plugin would be very helpfull. Currently we call Lint from an editor via Batch file + external *.lnt files (the rules) How do we have to do this in the Plugin?
06.06.2009 - 12:02
Daniel: Guideline needed
Hello, its great to have such a tool with this flexibility, nevertheless A short guideline how to integrate e.g. PC-Lint into the Plugin would be very helpfull. Currently we call Lint from an editor via Batch file + external *.lnt files (the rules) How do we have to do this in the Plugin?
08.04.2009 - 03:41
_: Lint-Support
Hi, instead using PClint it would be nice if user can specify a file with the lint output. Than this plugin would also work with FlexeLint I guess
09.02.2009 - 15:20
Michael: ... 0.9.7.5 released + 0.9.7.7 test version
the 0.9.7.7 already has the new build integrated, that would mean:
- on file save the build is initiated
- if already a build is running the build is queued, unless...
- the same file(s) are saved again: the previous build is canceled
- the new build is a clean build: then also previous builds are canceled
- run single test (with combobox selection)
04.02.2009 - 14:24
Michael: version 0.9.7.5 coming soon...
... already available at the test-site. If I (or one of you) don't find any major bugs, I'll copy it to the main release update site. new features / fixes:
- support for VC++ Compiler
- better support for unit testing (view + linking the needed objects)
- doxygen view + firefox
- some more marker resolutions
and a lot of fixes...
03.02.2009 - 11:23
Michael: Uaahhahahaa -> Bug in PcLint-Import
Hello,
so GroovyD was right, when importing the settings from CDT to the lint-settings there is a comment added with a "#" this should be a "//". Anyway: it would still be better if you used an existing lnt-File and use that configuration to import the lnt-Settings to CDT. That way you'd know the configuration works with lint. If the same configuration doesn't work with CppChecker, it's a bug!
02.02.2009 - 15:00
Michael: working on documentation and demonstrations
Today I started using wink to create demonstrations of how to use CppChecker.
The first impression of using the CppUnit part may be seen here.
This is - however - not about configuration and settings. But I'll do that within the next weeks, so be patient
here ist the link: demo It's a shockwave (1 MB) by the way.
02.02.2009 - 05:26
Michael: Lint + ArmCC
Hello GroovyD,
OK - the installation instructions so far are a little outdated, but I didn't have the time yet to make them any better. So - still: The main issue, if such an error like "missing implicit include" occurs is: the include paths are not set correctly! When using PC-Lint you'll have to keep in mind: where is my configuation lnt-file located and where are the included lnt-Files. example: supposed your configuration.lnt is in C:\mydir and your lint-installation and the config files are in C:\programs\lint, then try to add the followeing options to your lint settings:
// your configuration lint: first the include path, then the file itself - so any files within this directory // that are imported, will be imported automatically. +I"C:\mydir" configuration.lnt +I"C:\programs\lint"
and the error with "#" looks like you were trying to add comments with "#", which should start with "//".
Anyone: For posting errors: please use the above link "Report A Bug" at the top (!) of the page. And: activate the traces in the Trace Settings tab and try to figure out first, if your include paths are set correct. If not, it normally is not the problem of this plug-in. That is, I could try to give better feedback on errors of course! But I can't detect every configuration problem.
To the ArmCC issue: there is no such support (yet). Maybe it would not be that difficult to implement an error output parser, but as I'm the only one on this project: I'd either need help or it won't be done. Simple thing. Normally it's not done with parsing - the other thing is the configuration and call of such a compiler, which is rather more tricky (as you can see from your errors). I was thinking about a method of invoking groovy code, that might be included from the settings tab to parse the compiler error output. But that's after version 1.0.0 for sure.
Thanks!
02.02.2009 - 03:01
Michael: Lint + ArmCC
Hello GroovyD,
OK - the installation instructions so far are a little outdated, but I didn't have the time yet to make them any better. So - still: The main issue, if such an error like "missing implicit include" occurs is: the include paths are not set correctly! When using PC-Lint you'll have to keep in mind: where is my configuation lnt-file located and where are the included lnt-Files. example: supposed your configuration.lnt is in C:\mydir and your lint-installation and the config files are in C:\programs\lint, then try to add the followeing options to your lint settings:
// your configuration lint: first the include path, then the file itself - so any files within this directory // that are imported, will be imported automatically. +I"C:\mydir" configuration.lnt +I"C:\programs\lint"
and the error with "#" looks like you were trying to add comments with "#", which should start with "//".
Anyone: For posting errors: please use the above link "Report A Bug" at the top (!) of the page. And: activate the traces in the Trace Settings tab and try to figure out first, if your include paths are set correct. If not, it normally is not the problem of this plug-in. That is, I could try to give better feedback on errors of course! But I can't detect every configuration problem.
To the ArmCC issue: there is no such support (yet). Maybe it would not be that difficult to implement an error output parser, but as I'm the only one on this project: I'd either need help or it won't be done. Simple thing. Normally it's not done with parsing - the other thing is the configuration and call of such a compiler, which is rather more tricky (as you can see from your errors). I was thinking about a method of invoking groovy code, that might be included from the settings tab to parse the compiler error output. But that's after version 1.0.0 for sure.
Thanks!
30.01.2009 - 16:45
GroovyD: ARM embedded development
I would eventually like to use this plugin to do embedded ARM development using eclipse and PCLint... perhaps this will help also parse the armcc compiler errors?
30.01.2009 - 16:43
GroovyD: PCLint and Mingw gcc
I followed the instructions for installing the plugin to the laatest eclipse and have set it up to PCLint a project i setup with a single C file in it to test. In the CppChecker Settings panel I enabled both Gcc Settings 'Gcc Active' & 'Import from CDT...' and PC-Lint Settings 'Lint Active' & 'Import from CDT...'
In the 'Problem' panel at the bottom appears 3 errors...
Description Resource Path Location Type Error in Lint-Call: C:\Data\Eclipse\TestPort\options164.lnt(7): Error 305: Unable to open module '#' TestPort C:\Data\Eclipse\TestPort CppChecker Common Problem
Missing implicit include: (mingw-vista /
... special / ... r3)' / ... unsigned / ... int' testport.cpp TestPort C:\Data\Eclipse\TestPort\testport.cpp CppChecker Gcc Problem
No such file or directory testport.cpp TestPort C:\Data\Eclipse\TestPort\testport.cpp CppChecker Gcc Problem
Any thoughts on what might be wrong?
10.01.2009 - 09:54
Bob Swift: Unit test
Michael, just getting back to upgrading to get unit test support. By the way, 0.9.1 level has been very stable
. I see you are at 0.9.5.5 in CVS but only 0.9.5 on update site. Do you recommend that level or 0.9.5? I need something stable other than the unit test stuff. Also, I can't seem to see the cppunit component in CVS - am I missing something? We can do this via email, but, couldn't find a reference for you. I am at ########### [xed the comment - Michael]
07.12.2008 - 15:01
Michael: Re: UnitTest++
Hi Bob, I'm not sure if I have solved this aspect (ant/gant-build). The CppUnit-support is still a bit messy at the moment. I have solved it - probably partly. Maybe you should contact me via eMail?
Greetings
Michael
older comments: CppChecker-OlderComments
::history::EclipsePlugins/CppChecker