ddobrev / QtSharp

Mono/.NET bindings for Qt
Other
574 stars 51 forks source link

System.InvalidCastException: Can't cast type 'CppSharp.AST.Class' into 'CppSharp.AST.ClassTemplateSpecialization'. #82

Open nathan130200 opened 6 years ago

nathan130200 commented 6 years ago

I cloned repository, and i executed command to create bindings like in docs:

"..\QtSharp.CLI.exe" "C:\Qt\5.11.1\mingw53_32\bin\qmake.exe" "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe"

But throw an exception:

Exceção Sem Tratamento: System.InvalidCastException: Não é possível converter um objeto do tipo 'CppSharp.AST.Class' no tipo 'CppSharp.AST.ClassTemplateSpecialization'.
   em CppSharp.DeclConverter.VisitClassTemplate(ClassTemplate decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTemplateSpecialization(TemplateSpecializationType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypedef(TypedefDecl decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitTemplate(Template template, Template _template)
   em CppSharp.DeclConverter.VisitClassTemplate(ClassTemplate decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTemplateSpecialization(TemplateSpecializationType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypedef(TypedefDecl decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitTemplate(Template template, Template _template)
   em CppSharp.DeclConverter.VisitClassTemplate(ClassTemplate decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTemplateSpecialization(TemplateSpecializationType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypeAlias(TypeAlias decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitTemplate(Template template, Template _template)
   em CppSharp.DeclConverter.VisitTypeAliasTemplate(TypeAliasTemplate decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclaration(Declaration decl, Declaration _decl)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclaration(Declaration decl, Declaration _decl)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTag(TagType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.TypeConverter.VisitPointer(PointerType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.TypeConverter.VisitTemplateParameterSubstitution(TemplateParameterSubstitutionType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypedef(TypedefDecl decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClassTemplateSpecialization(ClassTemplateSpecialization decl, ClassTemplateSpecialization _decl)
   em CppSharp.DeclConverter.VisitClassTemplateSpecialization(ClassTemplateSpecialization decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitClassTemplate(ClassTemplate decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTemplateSpecialization(TemplateSpecializationType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.TypeConverter.VisitDependentName(DependentNameType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypedef(TypedefDecl decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitTemplate(Template template, Template _template)
   em CppSharp.DeclConverter.VisitClassTemplate(ClassTemplate decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTemplateSpecialization(TemplateSpecializationType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypedef(TypedefDecl decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTag(TagType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitField(Field decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitTemplate(Template template, Template _template)
   em CppSharp.DeclConverter.VisitClassTemplate(ClassTemplate decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTemplateSpecialization(TemplateSpecializationType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypedef(TypedefDecl decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTypedef(TypedefType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitTypedef(TypedefDecl decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.DeclConverter.VisitClass(Class class, Class _class)
   em CppSharp.DeclConverter.VisitClass(Class class)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.TypeConverter.VisitTag(TagType type)
   em CppSharp.TypeVisitor`1.Visit(Type type)
   em CppSharp.TypeConverter.VisitQualified(QualifiedType qualType)
   em CppSharp.DeclConverter.VisitFunction(Function function, Function _function)
   em CppSharp.DeclConverter.VisitFunction(Function decl)
   em CppSharp.DeclVisitor`1.Visit(Declaration decl)
   em CppSharp.DeclConverter.Visit(Declaration decl)
   em CppSharp.DeclConverter.VisitDeclContext(DeclarationContext ctx, DeclarationContext _ctx)
   em CppSharp.ASTConverter.Convert()
   em CppSharp.ClangParser.ConvertASTContext(ASTContext context)
   em CppSharp.Driver.ParseCode()
   em CppSharp.ConsoleDriver.Run(ILibrary library)
   em QtSharp.CLI.Program.Main(String[] args) na C:\Users\Nathan Ferreira\Desktop\QtSharp\QtSharp.CLI\Program.cs:linha 196

This line:

            ConsoleDriver.Run(qtSharp);

Qt and QMake Version: 5.11.1 Mingw Version: mingw530_32 Platform: mingw32

ddobrev commented 6 years ago

@nathan130200 I've been working on the generator, CppSharp, for the last few days, in order to wrap Qt 5.11.2. I might be able to finish by the end of this week. I'll let you know.

nathan130200 commented 6 years ago

Okay, thanks for the info. I thought it was already available for 5.11.

ddobrev commented 6 years ago

Wrapping C++ is an enormous task and @tritao and myself are pretty much on our own. So almost every new Qt version reveals inadequacies in CppSharp which we need to fix.

ezolotko commented 6 years ago

@ddobrev thank you for your work! And what is the latest Qt version "supported" by QtSharp (i.e. the bindings can be generated for)?

ddobrev commented 6 years ago

@ezolotko I've fixed 3 bugs but at least one more remains. I'll let you know when it's out of the way.