未定义的符号:10.6.7 中 MacOSX 64 位链接错误的 __dyld_func_lookup
我正在尝试编译一个引用 __dyld_func_lookup
的程序。
一切都编译良好,表明包含文件能够找到函数引用。但是,在最终链接时,我收到此错误:
g++ -o ../lib/macosx64/libcogmapapi.dylib -dynamiclib ./build/CogMapApi.o ./libs/cmlabs/macosx64/AIR.a ./libs/cmlabs/macosx64/CoreLibrary.a
Undefined symbols:
"__dyld_func_lookup", referenced from:
_reference in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
我尝试在链接器中使用 -undefineddynamic_lookup
并且它确实链接正确,但在运行时我得到了未定义的符号,就像我实际引用的一样我的代码中的 __dyld_func_lookup 。我猜我需要链接到一些 dylib 或框架,但我尝试的所有内容(例如 System 和 libdl.dylib )似乎都不起作用。
任何帮助将不胜感激!
I'm trying to compile a program that references __dyld_func_lookup
.
Everything compiles fine, indicating include files were able to find the function reference. However, upon the final linking, I get this error:
g++ -o ../lib/macosx64/libcogmapapi.dylib -dynamiclib ./build/CogMapApi.o ./libs/cmlabs/macosx64/AIR.a ./libs/cmlabs/macosx64/CoreLibrary.a
Undefined symbols:
"__dyld_func_lookup", referenced from:
_reference in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
I've tried using -undefined dynamic_lookup
in the linker and it does link properly, but then at runtime I get the undefined symbol as I do actually reference __dyld_func_lookup
in my code. I'm guessing I need to link to some dylib or framework, but everything I tried like System and libdl.dylib did not seem to work.
Any help would be most appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在同样的情况下,链接 dylib1.0 对我有用。
Linking dylib1.0 worked for me in same situation.