getting luabind together

Started by
5 comments, last by l2u 16 years, 11 months ago
Hello I've been having headaches with getting luabind to work on Windows.. I use MSVC 8.0 (2005) First I tried to build it with boost bjam This is what I did: my boost location: c:\cpp libraries\boost_1_33_1 c:\cpp libraries\boost (built libraries) c:\cpp libraries\luabind c:\cpp libraries\lua-5.1.2 I set environmental variables: set BOOST_ROOT="c:\cpp libraries\boost_1_33_1" set BOOST_BUILD_PATH="c:\cpp libraries\boost_1_33_1\tools\build\v2" set LUA_PATH="c:\cpp libraries\lua-5.1.2" before that I built Lua 5.1.2 with MSVC as static library and put it in ..lua-5.1.2\lib dir. Then I went to luabind dir and did bjam. The errors I got: warning: no toolsets are configured. warning: you won't be able to build C++ programs. warning: please consult the documentation. ..etc... Then I tried including luabind and lua-5.1.2 include directories in my compiler and when I tried to compile some examples I got loads of compile errors: C:\cpp libraries\luabind\luabind/detail/call.hpp(234) : error C2146: syntax error : missing ';' before identifier 'converter_ret' C:\cpp libraries\luabind\luabind/detail/call.hpp(234) : warning C4551: function call missing argument list C:\cpp libraries\luabind\luabind/detail/call.hpp(234) : error C2065: 'converter_ret' : undeclared identifier C:\cpp libraries\luabind\luabind/detail/call.hpp(236) : error C2228: left of '.apply' must have class/struct/union ..etc.. Please help me what should I do? Thank you very much for help
Advertisement
I've put up a precompiled package for Visual C++ 2005 users here:
www.nuclex.org/downloads/developers/kits/luabind-binaries-and-demo.
It contains an example application that's designed to run out of the box with no configuration steps whatsoever and contains binaries of lua and luabind (both debug and release builds).

There's also a small LuaBind tutorial available on my site that explains the basics of LuaBind, based on that package:
www.nuclex.org/articles/quick-introduction-to-luabind


As to the original error, I haven't used bjam before (I just compiled LuaBind without it), but it sounds like you forgot some important step in setting it up for your environment. Maybe there's another environment variable required for it to use the VC++2k5 compiler.

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
I thought its recommented building it with bjam..

When I build libraries, where should I put them?

Luabind documentation says:

It is extremely important that your application has the same settings as the library was built with.

Should I consider this?
The reason why bjam is the official build system for LuaBind is that it's not bound to a specific platform whereas VC project files or makefiles would only work on windows or linux/gcc machines respectively. Anybody who's got a working C++ compiler toolchain and bjam, no matter what, can build LuaBind.

The "same settings" most likely is about a typical error people make when using static libraries: Any application that links to a static library needs to be compiled with the exact same runtime settings the library has been compiled with. A favorite amongst Visual C++ developers is to mix up the single threaded/multi threaded/multi threaded DLL versions of the C runtime and to link debug libraries against release builds ;)

The binary package on my site uses the multi threaded DLL runtime (basically the only sane choice for any serious project involving more than a single exe, also the default setting since VS2003) and has separate release (luabind.msvc8.lib) and debug (luabind-d.msvc8.lib) libraries.

I didn't use bjam because I wanted to be 100% sure of what compiler settings the libraries are compiled with. The project file I used to compile LuaBind is in library_sources.zip\luabind\build\msvc8\ in the archive!

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Will compiler automatically use release/debug version of library in case I compile my application in release/debug mode?

Genereally, no

(The exception being that when you would add the LuaBind project into your solution and set it as a dependency to your project by right clicking on your project, selecting 'dependencies' and checking the LuaBind project. But that's not the case here).

I have manually entered luabind-d.msvc8.lib for the debug configuration of the example project and luabind.msvc8.lib for the release configuration. This is done in the project settings (right click on project in solution explorer and select 'properties') in the Linker/Input category. There's a text box named 'additional import libraries' where the LuaBind libraries need to be added.

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Thank you very much mate.
I finaly made it work..

I wonder how boost always knows what libraries to link? (I dont think it depends on what project settings you use - if you build you project in release/debug mode, etc.)



Another thing:

I've been trying to do something similar with Luabind:

c++ code:

std::string sometext() {
return std::string("some text..");
}

lua script

str = 'this is ... ' . sometext

I want to call sometext function in c++ from lua script and then return string so it would join str.

so str would be: "this is ... some text.."

PS: sorry, forum doesnt show code tags

This topic is closed to new replies.

Advertisement