Sign in to follow this  
NSDuo

errors in luabind [SOLVED]

Recommended Posts

Lua just loves to give me problems. Question: When I compile LuaBind in Xcode, I get errors within LuaBind, what do you do when there are errors in someone else's code? I managed to set up Lua for my game engine, and I apparently needed a binding library in order to access my C++ classes in it. The GD wiki's only lua tutorial is setting up LuaPlus, but I heard that LuaPlus is out-dated and you can't really get support for it. This led me to use LuaBind instead. After a major hassle getting Xcode header search paths working I successfuly eliminated these errors I was getting about missing files. Now that all the files are in order, I have been getting errors within LuaBind. Things I should mention: 1. I only included the LuaBind header files, before I posted this, I tried including the rest of the source, but I still got the errors. 2. I didn't use "make" to compile anything, Luabind didn't even come with a makefile. Instead it came with a jamroot executable (which I can't use). 3. The errors only occur when I include "luabind.hpp". I think this is because Xcode only compiles files when they are used, but it might be something else, so I'm mentioning it just in case. To repeat the question for clarity: What do you do when you get compiler errors in someone else's code? I'm using Xcode 3.1.3/gcc 4.0 Mac OS X 5.7 2.16Ghz Intel core2Duo 1GB of RAM [Edited by - NSDuo on July 23, 2009 1:24:05 PM]

Share this post


Link to post
Share on other sites
It's more helpful if you include the error in your description. I had some err
or when compiling Luabind for the mac as well but I'm not sure if its the same one.

Good Luck!

-ddn

Share this post


Link to post
Share on other sites
I was pressed for time, I thought the question "what should I do if a third party library has errors in it?" could sum everything up, but I guess not.

policy.hpp line 636
error: macro "check" passed 2 arguments, but takes just 1

handle.hpp line 128
error: expected unqualified-id before '{' token

nil.hpp line 36
error: expected unqualified-id before numeric constant

object.hpp line 107
error: expected unqualified-id before ';' token

line 108
error: declaration does not declare anything

line 113
error: expected unqualified-id before ')' token

line 117
error: 'luabind::adl::is_object_interface_aux::impl<T>::value' is not a valid template argument for type 'bool' because it is a non-constant expression

line 867
error: expected unqualified-id before '{' token

line 888
error: expected unqualified-id before '{' token

has_get_pointer.hpp line 82
error: expected unqualified-id before ';' token

line 83
error: declaration does not declare anything

line 90
error: expected unqualified-id before ')' token

line 94
error: 'luabind::detail::has_get_pointer_::impl<T>::value' is not a valid template argument for type 'bool' because it is a non-constant expression

I'm hesitant to modify the code because the luabind website said that it can compile in GCC 4.0. After a second look, I noticed something about environment variables to direct it to lua and boost. I'm thinking this might have something to do wiith why the jamroot program didn't work.

So knowing this:

How do I set an environment variable? Is it within the terminal? (remember I'm using Mac OS X)

If I manage to get it compiled, I will get a dylib library right? And I can use it just like a framework library?

Share this post


Link to post
Share on other sites
Quote:
Original post by NSDuo
Question: When I compile LuaBind in Xcode, I get errors within LuaBind, what do you do when there are errors in someone else's code?

You fix your build environment. If it's not broken, then you edit their code. It's very unlikely their code has 'errors' in it, more that it was not written for your particular compiler and platform combination. It's most likely that there's something in their build script that you're not replicating, like setting preprocessor directives. Look into that and see if there's more you can do.

Share this post


Link to post
Share on other sites
I'm starting to get really confused now...

Has anyone had experience getting luabind to work? (or any other binding library, I'm flexible). Maybe if I see how someone else set it up successfully, I can do it too.

Share this post


Link to post
Share on other sites
Yeah this stumped me for awhile too, the problem is on the mac there are several macros which conflict with Luabind. I don't know why no one checked this but the macros,

check and nil conflict with some Luabind variables and functions. The check macro is used in debug builds for asserts and the macro nil is some throw back support for an alternative definition of NULL.

Quick and dirty, you can undefine the macros within the Luabind headers and redfine them at the end. I didn't bother redefining them but you should. Here's how u can undef them, this is luabind.hpp btw.



#ifndef LUABIND_BIND_HPP_INCLUDED
#define LUABIND_BIND_HPP_INCLUDED

#ifdef check
#undef check
#endif

#ifdef nil
#undef nil
#endif

#include <luabind/config.hpp>
#include <luabind/class.hpp>
#include <luabind/function.hpp>
#include <luabind/open.hpp>

#endif // LUABIND_BIND_HPP_INCLUDED





Good Luck!

-ddn

Share this post


Link to post
Share on other sites
Hi,

I am currently trying to do the same thing, but I get alot of template errors (all files seem to get found though):

I also did this:


#ifndef LUABIND_BIND_HPP_INCLUDED
#define LUABIND_BIND_HPP_INCLUDED

#ifdef check
#undef check
#endif

#ifdef nil
#undef nil
#endif

#include <luabind/config.hpp>
#include <luabind/class.hpp>
#include <luabind/function.hpp>
#include <luabind/open.hpp>

#endif // LUABIND_BIND_HPP_INCLUDED



these are some of the errors:

../../../../luabind-0.8.1/luabind/class.hpp:1029: error: expected identifier before numeric constant
../../../../luabind-0.8.1/luabind/class.hpp:1029: error: expected `>' before numeric constant
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: 'B1' was not declared in this scope
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: 'B2' was not declared in this scope
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: 'B3' was not declared in this scope
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: type/value mismatch at argument 1 in template parameter list for 'template<class A0, class A1, class A2, class A3> struct luabind::bases'
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: expected a type, got '0'
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: template argument 2 is invalid
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: template argument 3 is invalid
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: template argument 4 is invalid
../../../../luabind-0.8.1/luabind/class.hpp:1030: error: template argument 1 is invalid
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: type/value mismatch at argument 1 in template parameter list for 'template<class T> struct luabind::detail::type_'
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: expected a type, got '0'
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: 'B1' was not declared in this scope
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: template argument 1 is invalid
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: 'B2' was not declared in this scope
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: template argument 1 is invalid
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: 'B3' was not declared in this scope
../../../../luabind-0.8.1/luabind/class.hpp:1032: error: template argument 1 is invalid
../../../../luabind-0.8.1/luabind/class.hpp:1202: error: no matching function for call to 'raw(boost::arg<1>&)'
../../../../luabind-0.8.1/luabind/class.hpp:1212: error: no matching function for call to 'raw(boost::arg<1>&)'


Does anybody have any idea about how to fix that?

Share this post


Link to post
Share on other sites
Looks like you don't have Boost setup correctly. Double check how Boost is included in your project and that Luabind can find the appropriate headers. I tried redefining the marcos but it doesn't seem to work, so beware that after your lubabind.hpp those 2 macros won't work anymore, so just code appropriately.

Good Luck!

-ddn

Share this post


Link to post
Share on other sites
do you know if I have to include any boost dylib or something? I only linked the headers, thanks!

EDIT: I read somewhere that luabind only works with LUA 5.1.2, not with the newest 5.1.4, is that true?

I am currently linking to all the headers from boost, lua and luabind through the header searchpaths in my project settings. do i have to do anything else to make it work?

[Edited by - mokaschitta on August 2, 2009 5:28:26 AM]

Share this post


Link to post
Share on other sites
Okay, the new version don't seem to work with GCC 4.0, I switched to GCC 4.2 in my project settings and they were gone. Anyways, I would still like to make it work with GCC 4.0 :(

EDIT: I just played around with older versions of LUA, luabind and boost and i figgured that the problem is the new boost_1_39_0 version. If you want to use luabind width GCC 4.0 you apparently have to use boost_1_38_0 :). If you do so it works with Lua 5.1.4 and the newest luabind.

[Edited by - mokaschitta on August 2, 2009 10:54:59 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this