Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Multiple source files and symbols unresolved

Hi there,

I'm parsing each field of the following C structure.

#ifndef __AERO_MESSAGES_H__
#define __AERO_MESSAGES_H__

struct CINEMATIC
{
    T_GeodeticLocation location;
    T_Attitude attitude;
    T_SpeedVector speed;
    char text[50];
    double yaw;
    T_SpeedVector speeds[20];
    QString toto;
    quint64 test_int;
    char* forbidden;
};

#endif // __AERO_MESSAGES_H__

I'm getting the type of members from a CField object.
IType type = field.getType();

But in fact locationattitudespeedare of type ProblemType.
speeds is of type CArrayType but when I print it, I get "? [20]".


So as I could expect, all my custom types are unresolved. How to specify multiple files when creating the IASTTranslationUnit in order to resolve all types (or specify an include path) ?
I'm using that code currently:

FileContent content = FileContent.createForExternalFileLocation(file.getAbsolutePath());
IScannerInfo scanner = new ScannerInfo();
IncludeFileContentProvider provider = SavedFilesProvider.getInstance();
IParserLogService log = new DefaultLogService();
try
{
IASTTranslationUnit unit = engine.getASTTranslationUnit(content, scanner, provider, null, 0, log);
unit.accept(new StructVisitor(true));
}
catch(Exception e)
{
}

I also tried to simply add an include statement in my .h file:
#include "GeodeticLocation.h"

GeodeticLocation.h:

#ifndef __GEODETICLOCATION_H__
#define __GEODETICLOCATION_H__

struct T_GeodeticLocation
{
    int test;
};

#endif // __GEODETICLOCATION_H__

But the application crashes when creating the IASTTranslationUnit:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/jobs/ISchedulingRule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.cdt.internal.core.parser.SavedFilesProvider.getContentForInclusion(SavedFilesProvider.java:38)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor$1.checkFile(CPreprocessor.java:159)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor$1.checkFile(CPreprocessor.java:1)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.findInclusion(CPreprocessor.java:1119)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.executeInclude(CPreprocessor.java:1497)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.executeDirective(CPreprocessor.java:1273)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.internalFetchToken(CPreprocessor.java:900)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.fetchToken(CPreprocessor.java:624)
at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.nextToken(CPreprocessor.java:721)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.fetchToken(AbstractGNUSourceCodeParser.java:274)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.nextToken(AbstractGNUSourceCodeParser.java:298)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.acceptInactiveCodeBoundary(AbstractGNUSourceCodeParser.java:359)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.declarationList(AbstractGNUSourceCodeParser.java:1322)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parseTranslationUnit(AbstractGNUSourceCodeParser.java:1295)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.translationUnit(AbstractGNUSourceCodeParser.java:1290)
at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parse(AbstractGNUSourceCodeParser.java:654)
at org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage.getASTTranslationUnit(AbstractCLikeLanguage.java:165)
at model.Model.generate(Model.java:40)

Thank you very much for your help ! :)





Back to the top