2015-07-20 85 views
1

我剛開始使用Luabind,並試圖運行指定的Hello World測試http://www.rasterbar.com/products/luabind/docs.html#calling-lua-functions。但是,這在嘗試編譯時會提供未定義的符號錯誤。Luabind未定義的符號/ Luabind :: scope :: scope

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 ::開放和luabind :: call_function正常工作。

我在osx上通過自制軟件安裝了luabind和lua 5.1。

回答

0

它看起來像我正在編譯您的程序對libC++,並試圖鏈接到一個針對stdlibC++庫編譯的luabind庫。

線索是std :: __ 1 :: auto_ptr。這__1內嵌命名空間使用的libC++來區分它是由ABI ++ stdlibc

因此,如果

luabind::scope::scope(std::__1::auto_ptr<luabind::detail::registration>) 

不能發現它可能是因爲libluabind沒有它。傾銷它的導出符號,您可能會發現它具有

luabind::scope::scope(std::auto_ptr<luabind::detail::registration>) 

取而代之。

如果我是正確的,只需重新編譯libluabind目標libC++,你會發現它適用於你的測試程序。