李逍遥*_*李逍遥 5 rpath dylib go cgo
我尝试在cgo中导入dylib动态库,但失败。这是我的代码。
\n\npackage main\n//#cgo CFLAGS: -I./yun2txt/include\n//#cgo LDFLAGS: -L./yun2txt/lib -ltotxt\n//\n//#include <library.h>\nimport "C"\n\nfunc main() {\n C.hello()\n}\n\n
Run Code Online (Sandbox Code Playgroud)\n\n也有错误。
\n\ndyld: Library not loaded: @rpath/libtotxt.dylib\n Referenced from: /private/var/folders/2n/k70s3c1j08q2z_6kw06n13nh0000gn/T/___go_build_cgo\n Reason: image not found\n\n
Run Code Online (Sandbox Code Playgroud)\n\n我该如何解决这个问题\xef\xbc\x9f
\n