尝试在Eclipse-cdt中导入和索引大型c ++ 11项目,并且索引器崩溃。在log work_space / .metadata / .log中,存在数千种此类错误:
!ENTRY org.eclipse.cdt.core 4 0 2018-01-22 20:20:49.031
!MESSAGE Error while parsing /Step/SendOne.cpp.
!STACK 0
java.lang.NullPointerException
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.listInitializationSequenceHelper(Conversions.java:435)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.listInitializationSequence(Conversions.java:427)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.nonReferenceConversion(Conversions.java:296)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.checkImplicitConversionSequence(Conversions.java:229)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.checkAggregateInitialization(Conversions.java:378)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.listInitializationSequenceHelper(Conversions.java:471)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.listInitializationSequence(Conversions.java:427)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.nonReferenceConversion(Conversions.java:296)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Conversions.checkImplicitConversionSequence(Conversions.java:229)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.findImplicitlyCalledConstructor(CPPSemantics.java:3697)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.findImplicitlyCalledConstructor(CPPSemantics.java:3662)
at org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.findImplicitlyCalledConstructor(CPPSemantics.java:3623)
at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator.getImplicitNames(CPPASTDeclarator.java:282)
at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator.accept(CPPASTDeclarator.java:193)
at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTSimpleDeclaration.accept(CPPASTSimpleDeclaration.java:110)
at org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit.accept(ASTTranslationUnit.java:275)
at org.eclipse.cdt.internal.core.pdom.PDOMWriter.process(PDOMWriter.java:533)
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.writeToIndex(AbstractIndexerTask.java:1279)
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseFile(AbstractIndexerTask.java:1096)
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseLinkage(AbstractIndexerTask.java:896)
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.runTask(AbstractIndexerTask.java:557)
at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.run(PDOMIndexerTask.java:161)
at org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask.run(PDOMRebuildTask.java:90)
at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:155)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
此错误显示几乎所有cpp文件。在日志的最底部:
!ENTRY org.eclipse.cdt.core 4 0 2018-01-23 09:24:52.304
!MESSAGE Error
!STACK 1
org.eclipse.core.runtime.CoreException: Too many errors while indexing, stopping indexer.
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.swallowError(AbstractIndexerTask.java:1189)
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseFile(AbstractIndexerTask.java:1117)
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseLinkage(AbstractIndexerTask.java:896)
at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.runTask(AbstractIndexerTask.java:557)
at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.run(PDOMIndexerTask.java:161)
at org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask.run(PDOMRebuildTask.java:90)
at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:155)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
!SUBENTRY 1 org.eclipse.cdt.core 4 0 2018-01-23 09:24:52.305
!MESSAGE Too many errors while indexing, stopping indexer.
!ENTRY org.eclipse.cdt.core 1 0 2018-01-23 09:24:52.309
!MESSAGE Indexed 'my_project' (168 sources, 2,583 headers) in 2,258 sec: 255,357 declarations; 811,215 references; 0 unresolved inclusions; 41 syntax errors; 1,689 unresolved names (0.18%)
我使用的是Ubuntu 16.04.3 LTS并尝试使用gcc 4.9.3和gcc 5.4.0 20160609。
Eclipse版本:Oxygen.2版本(4.7.2)构建ID:20171218-0600,但也尝试使用不同版本的Neon。
这是一个自定义的makefile项目,可以在eclipse和终端中正确构建。代码导航不起作用,绝大多数代码都是红色的。