Re: Linking errors when lua compiled as C++

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On Fri, Feb 26, 2010 at 01:00:31PM +0300, Roman Senuta wrote:
> Hello,

Hi,

>   I have a problem with linking my application with luabind and lua 
> libraries when lua library is compiled as C++ code. Linker gives a lot 
> of undefined reference errors to lua functions:
> 
> luabind_lib/libluabind.a(exception_handler.cpp.o): In function 
> `luabind::detail::(anonymous 
> namespace)::push_exception_string(lua_State*, char const*, char const*)':
> exception_handler.cpp:(.text+0x23): undefined reference to `lua_pushstring'
> exception_handler.cpp:(.text+0x36): undefined reference to `lua_pushstring'
> exception_handler.cpp:(.text+0x49): undefined reference to `lua_pushstring'
> ...
> 
> Problem is in lua_include.hpp header. It includes lua headers inside 
> extern "C" declaration. I had to hack it to make linking right. Is there 
> any way to do it better without altering luabind's source code?

No not right now. I suppose we could have a define for it,
LUABIND_CPLUSPLUS_LUA or something, and wrap the extern "C" lines in an
ifdef. Want do contribute a patch?

-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.