Luabind help

Started by
6 comments, last by mvBarracuda 15 years, 9 months ago
[EDIT] Solved by mvBarracuda, thanks a million!!!! He compiled it into a .lib that works with Microsoft Visual Studio 9.0, scroll down for download link. The situation: I got lua-5.1.3 working in my project but when i tried to get luabind-0.7 working with it, it just gives me errors and I can't fix them. LuaInterpreter.h

extern "C"
{
	#include <lua.h>
	#include <lualib.h>
	#include <lauxlib.h>
}
#include <luabind/luabind.hpp>

class LuaInterpreter
{
public:
	LuaInterpreter();
	void Test();
};


LuaInterpreter.cpp

#include <iostream>
#include "LuaInterpreter.h"

LuaInterpreter::LuaInterpreter()
{
}

void PrintSomething()
{
	std::cout << "I really want to see this message..." << std::endl;
}

void LuaInterpreter::Test()
{
	lua_State* interpreter = lua_open();
	luabind::open(interpreter);
	luabind::module(interpreter) [
		luabind::def("PrintSomething", PrintSomething)
	];
	luaL_dostring(interpreter, "PrintSomething()\n");
	lua_close(interpreter);
}


The Errors:

LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: __thiscall luabind::scope::~scope(void)" (??1scope@luabind@@QAE@XZ) referenced in function __unwindfunclet$?Test@LuaInterpreter@@QAEXXZ$0
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: void __thiscall luabind::module_::operator[](struct luabind::scope)" (??Amodule_@luabind@@QAEXUscope@1@@Z) referenced in function "public: void __thiscall LuaInterpreter::Test(void)" (?Test@LuaInterpreter@@QAEXXZ)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "void __cdecl luabind::open(struct lua_State *)" (?open@luabind@@YAXPAUlua_State@@@Z) referenced in function "public: void __thiscall LuaInterpreter::Test(void)" (?Test@LuaInterpreter@@QAEXXZ)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: __thiscall luabind::module_::module_(struct lua_State *,char const *)" (??0module_@luabind@@QAE@PAUlua_State@@PBD@Z) referenced in function "class luabind::module_ __cdecl luabind::module(struct lua_State *,char const *)" (?module@luabind@@YA?AVmodule_@1@PAUlua_State@@PBD@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: __thiscall luabind::scope::scope(struct luabind::scope const &)" (??0scope@luabind@@QAE@ABU01@@Z) referenced in function "struct luabind::scope __cdecl luabind::def<void (__cdecl*)(void)>(char const *,void (__cdecl*)(void))" (??$def@P6AXXZ@luabind@@YA?AUscope@0@PBDP6AXXZ@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: __thiscall luabind::scope::scope(class std::auto_ptr<struct luabind::detail::registration>)" (??0scope@luabind@@QAE@V?$auto_ptr@Uregistration@detail@luabind@@@std@@@Z) referenced in function "struct luabind::scope __cdecl luabind::def<void (__cdecl*)(void)>(char const *,void (__cdecl*)(void))" (??$def@P6AXXZ@luabind@@YA?AUscope@0@PBDP6AXXZ@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: __thiscall luabind::detail::registration::registration(void)" (??0registration@detail@luabind@@QAE@XZ) referenced in function "public: __thiscall luabind::detail::function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>::function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>(char const *,void (__cdecl*)(void),struct luabind::detail::null_type const &)" (??0?$function_commiter@P6AXXZUnull_type@detail@luabind@@@detail@luabind@@QAE@PBDP6AXXZABUnull_type@12@@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: void __thiscall luabind::detail::free_functions::function_rep::add_overload(struct luabind::detail::free_functions::overload_rep const &)" (?add_overload@function_rep@free_functions@detail@luabind@@QAEXABUoverload_rep@234@@Z) referenced in function "public: virtual void __thiscall luabind::detail::function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>::register_(struct lua_State *)const " (?register_@?$function_commiter@P6AXXZUnull_type@detail@luabind@@@detail@luabind@@UBEXPAUlua_State@@@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "int __cdecl luabind::detail::free_functions::function_dispatcher(struct lua_State *)" (?function_dispatcher@free_functions@detail@luabind@@YAHPAUlua_State@@@Z) referenced in function "public: virtual void __thiscall luabind::detail::function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>::register_(struct lua_State *)const " (?register_@?$function_commiter@P6AXXZUnull_type@detail@luabind@@@detail@luabind@@UBEXPAUlua_State@@@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: static struct luabind::detail::class_registry * __cdecl luabind::detail::class_registry::get_registry(struct lua_State *)" (?get_registry@class_registry@detail@luabind@@SAPAU123@PAUlua_State@@@Z) referenced in function "public: virtual void __thiscall luabind::detail::function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>::register_(struct lua_State *)const " (?register_@?$function_commiter@P6AXXZUnull_type@detail@luabind@@@detail@luabind@@UBEXPAUlua_State@@@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "int __cdecl luabind::detail::ref(struct lua_State *)" (?ref@detail@luabind@@YAHPAUlua_State@@@Z) referenced in function "public: virtual void __thiscall luabind::detail::function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>::register_(struct lua_State *)const " (?register_@?$function_commiter@P6AXXZUnull_type@detail@luabind@@@detail@luabind@@UBEXPAUlua_State@@@Z)
LuaInterpreter.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall luabind::detail::registration::~registration(void)" (??1registration@detail@luabind@@UAE@XZ) referenced in function "public: virtual __thiscall luabind::detail::function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>::~function_commiter<void (__cdecl*)(void),struct luabind::detail::null_type>(void)" (??1?$function_commiter@P6AXXZUnull_type@detail@luabind@@@detail@luabind@@UAE@XZ)


My first guess to why this is happening is because I don't have the luabind-0.7.dll or luabind-0.7.lib but if that is the problem I can't find them. I did come across luabind.x86.release however but putting it into my compilers lib folder and linking it gave me the error: LINK : fatal error LNK1181: cannot open input file 'luabind.x86.release'. I'm using Microsoft Visual Studio 9.0 if that means anything. Any help would be greatly appreciated! [Edited by - Tenac on June 25, 2008 12:28:32 AM]
Advertisement
Luabind 0.7 does only work with Lua 5.0.x. You got two options:
1. Use the latest Lua 5.0.x with Luabind 0.7.
2. Build latest luabind revision from SVN and use it with Lua 5.1.3.

Both options will work though going for building Luabind from SVN sounds better to me as they introduced some nice fixes and additions with the Lua 5.1.x releases.
-----PARPG - open source isometric 2d old school RPG still looking for interested contributors
Ehh, I'm going to give up on luabind for a while I think, it's not really needed yet, but I guess I'll look into it later when I am going to really need it.

After lots of research, I found 2 tutorials on how to set up luabind:
http://www.nuclex.org/articles/quick-introduction-to-luabind
http://developer.valvesoftware.com/wiki/Lua_tutorial

No matter what I try, I just can't get it to work. I'd love if luabind had a big update but I doubt that will happen soon. Thanks for the help though mvBarracuda but I think I'm just gonna give up on it for a while. Unless I stumble upon a luabind.lib that works with a copy-paste, I'm done with it for a while lol.

I also looked into tolua++ a tiny bit, but the compiling for that is too confusing and I'd really prefer not to use Python.
To be fair: building luabind from source is rather easy. In case you're familiar with building any open source library from source it should be cake.

In case you're not: what compiler are you using? If I got a spare minute some at one of the following days I could give it a shot.
-----PARPG - open source isometric 2d old school RPG still looking for interested contributors
I'm using Microsoft Visual Studio 9.0 (MSVC++ 2008 Express Edition). I've never built a .dll or .lib from source before, and I did a quick google but didn't come up with anything. I'm surprised so few people have compiled it and released it to the public, luabind should come with binaries I think.
Okay, here we go:
Luabind SVN trunk revision r510 - precompiled library

Some notes:
* You'll need a 7zip compatible tool (7zip or a newer winrar version) to unpack the archive.
* The package comes with the headers as well as with precompiled static debug and release libraries for MSVC2008.
* It was built against Boost 1.35.0, Lua 5.1.3 and is based on Luabind SVN revision 510 (trunk). It's likely that it will only work together in combinations with these revisions of the software.

Have fun :-)
-----PARPG - open source isometric 2d old school RPG still looking for interested contributors
Wow mvBarracuda, it actually works now =). You fucking rock. Thanks a million!!!! I owe you lol.

(It probably doesn't matter, but should I fix these compiling warnings)

Unknown compiler version - please run the configure tests and report the results

warning C4996: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xutility(2550) : see declaration of 'std::copy'

And 13 warnings because LNK4099: PDB 'vc90.pdb' was not found
(PDB 'filename' was not found with 'object/library' or at 'path'; linking object as if no debug info - http://msdn.microsoft.com/en-us/library/b7whw3f3(VS.80).aspx)

Thank you!!

[Edited by - Tenac on June 23, 2008 7:34:40 PM]
Quote:Original post by Tenac
Wow mvBarracuda, it actually works now =). You fucking rock. Thanks a million!!!! I owe you lol.

No problem, you're welcome :-)

Quote:Original post by Tenac
And 13 warnings because LNK4099: PDB 'vc90.pdb' was not found
(PDB 'filename' was not found with 'object/library' or at 'path'; linking object as if no debug info - http://msdn.microsoft.com/en-us/library/b7whw3f3(VS.80).aspx)

As far as I remember this error vanishes if you close MSVC, open the solution again and rebuild it again.

Cheers!
-----PARPG - open source isometric 2d old school RPG still looking for interested contributors

This topic is closed to new replies.

Advertisement