🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

issues/questions building luabind on msvc++

Started by
4 comments, last by nekoflux 20 years, 5 months ago
After reading several posts on this forum, Ive come to the conclusion that luaBind is probably my best option for binding cpp to lua scripts. But...surrise surprise, I download the src for the luabind only to find that it is unix oriented without any project files for msvc.. the luabind directory when extracted to my pc contains a src directory with a bunch of cpp files in it, and theres also a subdirectory called luabind...there a bunch of hpp header files in there. There is also a subdirectory within that directory named details which contain more hpp files. What do I build with what? Is there a lib that I need to generate from this source, or is the only output an exe file which I use to pass my source through? Also in the documentation for lua they mention that boost 1.30 must be installed (but only boost headers). What does this mean? do I just copy all the header files I find in the boost archive I downloaded into the luabind project as well? any help would be appreciated..I''m stuck thanks y''all neko
nekoflux
Advertisement
Bear with it, once you''ve got it setup once it gets much easier.

Boost:

Because of the use of templates, large chunks of boost don''t require cpp files. AFAIK, Luabind won''t require any of the compiled boost libraries. However, you do need to tell your compiler where to find the root directory of boost. Unzip boost, and then add the directory with the version numbers in it to your include directories eg/ ''c:\boost_1_30_0''. If you''ve never used boost before I recommend you get acquainted with it. boost article on codeproject


Luabind:

The documentation has instructions for building luabind. Basically you need to add the top level ''luabind'' directory to your include path, and then either compile the source as a static library or directly add the .cpp files in the ''luabind\src'' folder into your project.

Adding all the source files in the to your project is the simplest way to guarantee that it is built using the correct compiler options, but full rebuilds of the project may take a while.
Ok, cool, that worked, thanks bro!

Now on to try the luabind example you posted in the other thread

...

wish me luck

neko
nekoflux
ok, I built a release copy of the lib, stuffed it into my project along with the header files.

When I build it I get 5 warnings:

c:\program files\microsoft visual studio\vc98\include\utility(25) : warning C4786: ''std::_Treeair,std::map::ltstr,std::allocator >::_Kfn,luabind::detail::ltstr,std::allocator >::iterator'' : identifier was truncated to ''255'' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation ''std:airair,std::map::detail::class_rep::callback,luabind::detail::ltstr,std::allocator >::_Kfn,luabind::detail::ltstr,std::allocator >::iterator,bool>'' being compiled
c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function ''luabind::detail::class_rep::callback &__thiscall std::mapr,std::allocator >::operator [](const char *const & )''
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: ''std:airair,std::mapess,std::allocator >::_Kfn,std::less,std::allocator >::iterator,bool>:airairail::class_rep *>,std::map,std::allocator >::_Kfn,std::less,std::allocator >::iterator,bool>''
: identifier was truncated to ''255'' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: ''std:airair,std::mapstd::allocator >::_Kfn,luabind::detail::ltstr,std::allocator >::iterator,bool>:airair,std::mapabind::detail::method_rep,luabind::detail::ltstr,std::allocator >::_Kfn,luabind::detail::ltstr,std::allocator >::iterator,bool>'' : identifier was truncated to ''255'' characters in the debug in
formation
Linking...

3DEngine.exe - 0 error(s), 3 warning(s)


then when I try to run it, it crashes.

any ideas?? soo close...

neko
nekoflux
The warnings don''t matter. It''s just VC6 complaining that the names of the template classes are too long. Get rid of the problem by adding:

#pragma warning(disable:4786)

The crash is a bit more of a worry. Make sure that you have service pack 5 installed (which is required according to the luabind documentation). I wouldn''t be confident about any template code under a plain install of VC6. SP5 is a pretty big download though.

The only other thing I can think of off the top of my head is that you removed the extra scope block in main. a luabind::object is attached to a lua_State, and the destructor has to be called before lua_close is.
You are absolutely right, I forgot the luabind::object call as well as the open(L) call


works, like charm!!!! you rock man!!!

neko
nekoflux

This topic is closed to new replies.

Advertisement