You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
java.lang.NullPointerException: Could not initialize cppcheck for project lib-ltc #98
eclipse.buildId=4.13.0.I20190916-1045
java.version=1.8.0_171
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=nl_NL
Framework arguments: -product org.eclipse.epp.package.cpp.product -keyring /Users/arjanvanvught/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.cpp.product -keyring /Users/arjanvanvught/.eclipse_keyring
com.googlecode.cppcheclipse.core
Error
Tue Oct 01 21:55:37 CEST 2019
Could not initialize cppcheck for project lib-ltc
java.lang.NullPointerException
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getIncludes(ToolchainSettings.java:181)
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getUserIncludes(ToolchainSettings.java:87)
at com.googlecode.cppcheclipse.core.Checker.<init>(Checker.java:80)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.initChecker(Builder.java:164)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.processFile(Builder.java:199)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.visit(Builder.java:122)
at org.eclipse.core.internal.resources.Resource.lambda$1(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:135)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:55)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:105)
at com.googlecode.cppcheclipse.ui.Builder.processResource(Builder.java:306)
at com.googlecode.cppcheclipse.ui.commands.RunCodeAnalysis$RunCodeAnalysisJob.runResource(RunCodeAnalysis.java:26)
at com.googlecode.cppcheclipse.ui.commands.ResourceSelectionJob.run(ResourceSelectionJob.java:44)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)</init>
Using the latest Eclipse 2019-09 with the plug-in from the Marketplace, I get this exception every-time when I run the cppcheck from the source file (pull-down menu). I can reproduce it on Linux Ubuntu as well.
Second experiment you can do is install different build of cppcheclipse, what happens when you install this variant of the plugin?
com.googlecode.cppcheclipse.repository-1.1.1.v20190927-1540.zip
Also an exception.
eclipse.buildId=4.13.0.I20190916-1045
java.version=1.8.0_171
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=nl_NL
org.eclipse.core.runtime.CoreException: Could not initialize cppcheck for project lib-tcnet
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.initChecker(Builder.java:192)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.processFile(Builder.java:199)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.visit(Builder.java:122)
at org.eclipse.core.internal.resources.Resource.lambda$1(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:135)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:55)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:105)
at com.googlecode.cppcheclipse.ui.Builder.processResource(Builder.java:306)
at com.googlecode.cppcheclipse.ui.commands.RunCodeAnalysis$RunCodeAnalysisJob.runResource(RunCodeAnalysis.java:26)
at com.googlecode.cppcheclipse.ui.commands.ResourceSelectionJob.run(ResourceSelectionJob.java:44)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.NullPointerException
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getIncludes(ToolchainSettings.java:182)
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getUserIncludes(ToolchainSettings.java:88)
at com.googlecode.cppcheclipse.core.Checker.<init>(Checker.java:81)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.initChecker(Builder.java:164)
... 14 more
Can you share what source it is (it shouldn't matter), but still. Or can you export a project for me to try to replicate it?
Do you have some CDT plugin on top of Eclipse when you do the C coding? Is the C project configured correctly (building as managed project, not some external makefile)?
If you want to use marketplace version of the plugin then any cppcheck above v1.83 will not work even when you will have the project as a proper CDT project.
If you really want just rogue makefiles then you can just run cppcheck from them, no need for this plugin.
On top of CDT because your project is baremetal (cool project btw), you might want to use GNU MCU Eclipse plugin as well, if you have Olimex jtag then you should be able to do interactive debuging through the GME plugin (it helps orchestrating OpenOCD and configuring the right switches for the toolchain so then it generates correct makefiles for you)
On top of CDT because your project is baremetal (cool project btw),
Thanks!
you might want to use GNU MCU Eclipse plugin as well, if you have Olimex jtag then you should be able to do interactive debuging through the GME plugin (it helps orchestrating OpenOCD and configuring the right switches for the toolchain so then it generates correct makefiles for you)
I am not that eager with auto generated make files. I want to have full control on my own build process.
uname -a
Darwin MacBook-Air.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
cppcheck --version
Cppcheck 1.89
I had the same problem on some eclipse projects. Other projects worked just fine. The difference is, that the error occurs only in projects, where the source code is just linked to the eclipse workspace.
Might this be the root cause of the problem? - A solution would be very appreciated!
I have a similar problem. I can run cppcheck fine on 3 out of 4 projects but it throws the following error for a single project:
The main difference between this project and the others is that I have a whole bunch of linked files in this project. Also, there are includes from other projects to avoid code duplication. Not sure which one is causing this null pointer.
If I run cppcheck on a directory of this project does some checks (even though there are linked files in that directory) but complains that it cannot find all the includes (understandable) and the warnings are from the other project where the files are linked here! Not sure if the linked files are directing the cppcheck to the other project and it gets stuck there or not.
@AntonKrug, Figured out it has to do with the 'Is a workspace path' checkmark of the includes. When I enable this with a 'basic' test.cpp file i will get the same kind of error. It seems it is cppcheck unrelated, because it does not even get to the point it executes cppcheck.
@AntonKrug i mean it is not an issue of cppcheck.exe itself. It is an issue of the cppcheclipse plugin. So i ques it could only be closed if it is fixed.
Activity
AntonKrug commentedon Oct 2, 2019
Could you describe what you were doing and how to replicate it?
vanvught commentedon Oct 2, 2019
Using the latest Eclipse 2019-09 with the plug-in from the Marketplace, I get this exception every-time when I run the cppcheck from the source file (pull-down menu). I can reproduce it on Linux Ubuntu as well.
AntonKrug commentedon Oct 2, 2019
You didn't specify what version of cpccheck. Try to use cppcheck v1.83
AntonKrug commentedon Oct 2, 2019
Second experiment you can do is install different build of cppcheclipse, what happens when you install this variant of the plugin?
com.googlecode.cppcheclipse.repository-1.1.1.v20190927-1540.zip
vanvught commentedon Oct 2, 2019
MacOS : Cppcheck 1.89
Linux : Cppcheck 1.82 {latest from apt install}
vanvught commentedon Oct 2, 2019
Also an exception.
AntonKrug commentedon Oct 4, 2019
Can you share what source it is (it shouldn't matter), but still. Or can you export a project for me to try to replicate it?
Do you have some CDT plugin on top of Eclipse when you do the C coding? Is the C project configured correctly (building as managed project, not some external makefile)?
vanvught commentedon Oct 4, 2019
https://github.com/vanvught/rpidmx512
Yes, CDT latest release.
All projects are correctly configured with using an external makefile.
AntonKrug commentedon Oct 4, 2019
So then no, that's just external makefile project, The 'Managed' is CDT's term:
https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_c_build_over.htm
And CDT is not optional:
https://github.com/kwin/cppcheclipse/wiki/Installation#requirements
If you want to use marketplace version of the plugin then any cppcheck above v1.83 will not work even when you will have the project as a proper CDT project.
If you really want just rogue makefiles then you can just run cppcheck from them, no need for this plugin.
AntonKrug commentedon Oct 4, 2019
On top of CDT because your project is baremetal (cool project btw), you might want to use GNU MCU Eclipse plugin as well, if you have Olimex jtag then you should be able to do interactive debuging through the GME plugin (it helps orchestrating OpenOCD and configuring the right switches for the toolchain so then it generates correct makefiles for you)
vanvught commentedon Oct 4, 2019
I've got CDT (of course). I just corrected my comment.
vanvught commentedon Oct 4, 2019
Advantage of a plug-in is that the output is referenced to the source code.
vanvught commentedon Oct 4, 2019
Thanks!
I am not that eager with auto generated make files. I want to have full control on my own build process.
AntonKrug commentedon Oct 4, 2019
I imported it into my Eclipse and run check on your lib-tcnet and I didn't got any exceptions, see attachment.
cppcheck.txt
vanvught commentedon Oct 4, 2019
I really can't get it to work ;-(
bernhard2020 commentedon Jul 21, 2020
I had the same problem on some eclipse projects. Other projects worked just fine. The difference is, that the error occurs only in projects, where the source code is just linked to the eclipse workspace.
Might this be the root cause of the problem? - A solution would be very appreciated!
Mahdi-Hosseinali commentedon Nov 6, 2020
I have a similar problem. I can run cppcheck fine on 3 out of 4 projects but it throws the following error for a single project:

The main difference between this project and the others is that I have a whole bunch of linked files in this project. Also, there are includes from other projects to avoid code duplication. Not sure which one is causing this null pointer.
If I run cppcheck on a directory of this project does some checks (even though there are linked files in that directory) but complains that it cannot find all the includes (understandable) and the warnings are from the other project where the files are linked here! Not sure if the linked files are directing the cppcheck to the other project and it gets stuck there or not.
Hanzel44 commentedon Nov 23, 2020
@AntonKrug, Figured out it has to do with the 'Is a workspace path' checkmark of the includes. When I enable this with a 'basic' test.cpp file i will get the same kind of error. It seems it is cppcheck unrelated, because it does not even get to the point it executes cppcheck.
AntonKrug commentedon Nov 26, 2020
@Hanzel44 thank you very much for the update. With eclipse there is so much which can go wrong
@vanvught is yours issue workspace related as well, should we close this issue?
Hanzel44 commentedon Dec 9, 2020
@AntonKrug i mean it is not an issue of cppcheck.exe itself. It is an issue of the cppcheclipse plugin. So i ques it could only be closed if it is fixed.