Luabind Undefined Symbols / Luabind :: scope :: scope

时间:2015-07-20 01:53:35

标签: c++ c++11 lua luabind lua-5.1

我刚开始使用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和lua 5.1。

1 个答案:

答案 0 :(得分:0)

在我看来,您正在编写针对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,您就会发现它适用于您的测试程序。