Open emmauss opened 6 years ago
Problem is only when saving the generated code, so it looks like its processing and generating the bindings correctly.
I noticed your working path has spaces, maybe check if that makes any difference.
If not, please compile with master and check in the debugger why CppSharp.AST.TranslationUnit.get_FileRelativeDirectory
is null.
i will try with the debugger
i have built the cppsharp library, but when I reference it in my project, I get this
System.IO.FileNotFoundException: 'Could not load file or assembly 'CppSharp.Parser.CLI.dll' or one of its dependencies. The specified module could not be found.
stacktrace
at CppSharp.ConsoleDriver.Run(ILibrary library) at CppWrapper.Program.Main(String[] args) in C:\Users\Emmanuel Hansen\Documents\Visual Studio 2017\Projects\CppParser\CppParser\Program.cs:line 42
i have set the solution to build with x86 and release configuration
I have referenced CppSharp.Parser.CLI and the other porjects that would have been added in the nuget package
You need to copy CppSharp.CppParser.dll
next to your executable.
it now run. this is the exception
System.NullReferenceException: 'Object reference not set to an instance of an object.' IncludePath was null.
stacktrace
at CppSharp.AST.TranslationUnit.get_FileRelativeDirectory() in C:\Users\Emmanuel Hansen\CppSharp-master\CppSharp-master\src\AST\TranslationUnit.cs:line 66
at CppSharp.Driver.SaveCode(IEnumerable'1 outputs) in C:\CppSharp-master\CppSharp-master\src\Generator\Driver.cs:line 304
at CppSharp.ConsoleDriver.Run(ILibrary library) in C:\CppSharp-master\CppSharp-master\src\Generator\Driver.cs:line 459
at CppWrapper.Program.Main(String[] args) in C:\Users\Emmanuel Hansen\Documents\Visual Studio 2017\Projects\CppParser\CppParser\Program.cs:line 42
any help on this?
This is where we set IncludePath
for translation units. Presumably GetIncludePath()
fails for some translation units on your binding.
Can you add a breakpoint there and figure out if that is the case and why?
@tritao I did it, but it never failed. I check the unit data at the exception break point, it gave me this ` | Name | Value | Type |
---|---|---|---|
◢ | this | File = "Std.cs", Ignored = false | CppSharp.AST.TranslationUnit` |
I don't know where Std.cs
is. Its file path is the same as its name.
Brief Description
It throws null reference exception when it starts to generate code. I am parsing https://github.com/wjakob/nanogui, I can build and test it, so the generated libraries for parsing are available. I have set both the gui project and the parser project to build for x64. here is the parse log
OS: Windows 10 1803
Used headers
from this https://github.com/wjakob/nanogui/tree/master/include/nanogui
Used settings
Library class
Target: MSVC
Other settings
Stack trace or incompilable generated code