CppSharp icon indicating copy to clipboard operation
CppSharp copied to clipboard

Sequence contains no matching element occurred when generating sharp bindings for libtorrent

Open ycy1164656 opened this issue 3 years ago • 6 comments
trafficstars

Brief Description

OS: Windows

Used settings

Target: MSVC

Stack trace or incompilable generated code
    public void Setup(Driver driver)
    {
        Console.WriteLine(PathLibTorrentInclude);
        var options = driver.Options;
        options.GeneratorKind = GeneratorKind.CSharp;
        options.OutputDir = Path.Combine(Environment.CurrentDirectory, "output");
        options.Verbose = true;
       
        var module = options.AddModule("SharpLibtorrent");
        module.LibraryName = "SharpLibtorrent";
        module.OutputNamespace = "SharpLibtorrent";
        
        module.Headers.AddRange(Directory.EnumerateFiles(PathLibTorrentInclude, "*.hpp"));
        module.IncludeDirs.Add(PathLibTorrentInclude);
        foreach (string item in Directory.EnumerateDirectories(PathLibTorrentInclude))
        {
            Console.WriteLine(item);
            module.Headers.AddRange(Directory.EnumerateFiles(item, "*.hpp"));
            module.IncludeDirs.Add(item);
        }

    }

ycy1164656 avatar Dec 14 '21 14:12 ycy1164656

Please share your stack-trace as well.

ddobrev avatar Dec 14 '21 15:12 ddobrev

Please share your stack-trace as well.

here

"  
在 System.Linq.ThrowHelper.ThrowNoMatchException()\r\n   
在 System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)\r\n  
在 CppSharp.Generators.CSharp.CSharpSources.GenerateFieldGetter(Field field, Class class, QualifiedType returnType)\r\n   在 CppSharp.Generators.CSharp.CSharpSourcesExtensions.GenerateField(CSharpSources gen, Class class, Field field, Action`3 generate, Boolean isVoid)\r\n   
在 CppSharp.Generators.CSharp.CSharpSources.GeneratePropertyGetter[T](T decl, Class class, Boolean isAbstract, Property property)\r\n  
在 CppSharp.Generators.CSharp.CSharpSources.GenerateProperties(Class class)\r\n
在 CppSharp.Generators.CSharp.CSharpSources.GenerateClassProperties(Class class)\r\n   
在 CppSharp.Generators.CSharp.CSharpSources.VisitClassDecl(Class class)\r\n   
在 CppSharp.AST.Class.Visit[T](IDeclVisitor`1 visitor)\r\n   在 CppSharp.Generators.CSharp.CSharpSources.VisitDeclContext(DeclarationContext context)\r\n   在 CppSharp.Generators.CodeGenerator.VisitNamespace(Namespace namespace)\r\n   
在 CppSharp.Generators.CSharp.CSharpSources.VisitNamespace(Namespace namespace)\r\n   
在 CppSharp.AST.Namespace.Visit[T](IDeclVisitor`1 visitor)\r\n   在 CppSharp.Generators.CSharp.CSharpSources.VisitDeclContext(DeclarationContext context)\r\n   
在 CppSharp.Generators.CodeGenerator.VisitNamespace(Namespace namespace)\r\n   
在 CppSharp.Generators.CSharp.CSharpSources.VisitNamespace(Namespace namespace)\r\n   
在 CppSharp.Generators.CodeGenerator.VisitTranslationUnit(TranslationUnit unit)\r\n   
在 CppSharp.AST.TranslationUnit.Visit[T](IDeclVisitor`1 visitor)\r\n   
在 CppSharp.Generators.CSharp.CSharpSources.Process()\r\n   
在 CppSharp.Generators.Generator.GenerateModule(Module module)\r\n   
在 CppSharp.Generators.Generator.Generate()\r\n   
在 CppSharp.Driver.GenerateCode()\r\n   
在 CppSharp.ConsoleDriver.Run(ILibrary library)\r\n   
在 testApp.SharpLibtorrent.GenerateBindings() 
在 C:\\Users\\ycy\\source\\repos\\CppSharpTest\\testApp\\SharpLibtorrent.cs 中: 第 19 行\r\n   
在 Program.<Main>$(String[] args) 
在 C:\\Users\\ycy\\source\\repos\\CppSharpTest\\testApp\\Program.cs 中: 第 5 行"

ycy1164656 avatar Dec 14 '21 15:12 ycy1164656

Thank you, we'll check it whenever possible. Meanwhile your options are fixing it yourself with our help or contact our support.

ddobrev avatar Dec 14 '21 17:12 ddobrev

We need a way to reproduce this, can you minimize your headers into a self contained example that triggers the crash?

tritao avatar Dec 14 '21 17:12 tritao

We need a way to reproduce this, can you minimize your headers into a self contained example that triggers the crash?

here is the example

https://github.com/ycy1164656/CppSharpLibtorrent

ycy1164656 avatar Dec 15 '21 02:12 ycy1164656

@ycy1164656 did you ever resolve this? I'm hitting this issue as well with trying to generate bindings for sokol_gp.h

kkukshtel avatar Aug 07 '22 09:08 kkukshtel

@kkukshtel no,i gave up...

ycy1164656 avatar Dec 27 '22 04:12 ycy1164656