我刚刚开始使用Luabind,并尝试运行在http://www.rasterbar.com/products/luabind/docs.html#calling-lua-functions中指定的Hello World测试。但是,这会在尝试编译时提供一个未定义的符号错误。
Undefined symbols for architecture x86_64:
"luabind::scope::scope(std::__1::auto_ptr<luabind::detail::registration>)", referenced from:
luabind::scope luabind::def<void (*)(), luabind::detail::null_type>(char const*, void (*)(), luabind::detail::null_type const&) in TestClass.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)其他函数,如luabind::open和luabind::call_function都可以正常工作。
我在osx上通过自制软件安装了luabind和Lua5.1。
发布于 2015-12-08 21:28:10
在我看来,您正在使用libc++编译您的程序,并试图链接到针对stdlibc++库编译的Luabind库。
线索是std::__1::auto_ptr。libc++使用这个__1内联名称空间来区分它的ABI和stdlibc++
因此,如果
luabind::scope::scope(std::__1::auto_ptr<luabind::detail::registration>)找不到它很可能是因为libluabind没有它。转储它的导出符号,你可能会发现它有
luabind::scope::scope(std::auto_ptr<luabind::detail::registration>)而不是。
如果我是对的,只需重新编译以libc++为目标的libluabind,您就会发现它可以与您的测试程序一起工作。
https://stackoverflow.com/questions/31507853
复制相似问题