我正在使用SWIG與golang的集成來生成cgo文件。我正在鏈接一個C++lib和Go。我已經安裝了我的軟件包:并且它發生得很好。但是當我在這里啟動我的主要示例時:swig -go -cgo -c++ -intgosize 64 ./basic_host.igo installpackage mainimport ( "fmt" "myLib/basic_host")func main() { fmt.Println("Hello") basic_host.PrintHelpAndExit("test", 0) fmt.Println("World!")}當我嘗試啟動它時,我得到了,我的打印問候甚至沒有被考慮在內,似乎我的程序甚至沒有啟動...我不知道如何處理這個問題,因為調試工具甚至沒有啟動。exit status 3221225477退出狀態似乎與NIL指針引用有關:請參閱此處,肯定是由于cgo集成。我正在Windows 10上使用MinGW構建,在我的配置下:swig -versionSWIG Version 4.0.2Compiled with i686-w64-mingw32-g++ [i686-w64-mingw32]Configured options: +pcre我的SWIG接口文件是這樣的(basic_host.i):%module basic_host%{ #include <atomic> #include <map> #include <iostream> #include <memory> #include <myLib/myLib.hpp> #include "../../examples/basic_host/command_line.h" #include "../../examples/basic_host/command_line.cpp"%}%inline %{ extern void printHelpAndExit(const char* binary, unsigned int exitCode);%}
- 1 回答
- 0 關注
- 183 瀏覽
添加回答
舉報
0/150
提交
取消