Page 1 of 1

Lua Question

Posted: Sat Jul 10, 2010 3:46 pm
by Lord Pingas
Hello fellow game developers. :)

I'm working on this engine which is pretty good so far and it's going pretty well and I am trying to implement Lua.

The problem is that I'm using Code::Blocks and I have linked the includes and libs and everything but I keep getting "undefined reference" errors and I have googled and googled but I found nothing.

I have also included my lua files with extern "C".

Do you guys have any ideas on why this problem would occur, other than i'm stupid. ;)

Also there is nothing wrong with my code, I've researched and it all looks fine to me.

Re: Lua Question

Posted: Sat Jul 10, 2010 4:25 pm
by Zer0XoL
Lord Pingas wrote:Hello fellow game developers. :)

I'm working on this engine which is pretty good so far and it's going pretty well and I am trying to implement Lua.

The problem is that I'm using Code::Blocks and I have linked the includes and libs and everything but I keep getting "undefined reference" errors and I have googled and googled but I found nothing.

I have also included my lua files with extern "C".

Do you guys have any ideas on why this problem would occur, other than i'm stupid. ;)

Also there is nothing wrong with my code, I've researched and it all looks fine to me.
I may not know, try compiling the libraries for the compiler you are using or try getting the right libraries, i use luabind, are you using plain lua? I may know no further :P

Re: Lua Question

Posted: Mon Jul 19, 2010 10:16 am
by Lord Pingas
I'm not using luabind or any binding libraries, I'm just new to lua and I want to implement them to the engine I once had before I decided to rewrite it so it can be, well, more like an engine.

How would I set up lua correctly to Code::Blocks?

Oh and I'm so sorry for the very late reply, I completely forgot about this post.

Re: Lua Question

Posted: Tue Jul 27, 2010 9:16 pm
by GRENADIAC111
Hmm I don't know much about Code::Blocks but this site helped me implement Lua scripts into my engine maybe it can help you. http://gamedevgeek.com/tutorials/gettin ... d-with-lua

Re: Lua Question

Posted: Wed Jul 28, 2010 1:34 am
by WSPSNIPER
usually lua comes with .lib files which codeblocks can't use so create a new static lib project and add the lua files to it and build it. then link the lib you just built. make sure to build it in relaease... actually idk if it matters but that's what I did. you should get the file liblua.a and you link it with -llua

Re: Lua Question

Posted: Wed Jul 28, 2010 3:09 am
by dejai
Generally an undefined reference has to do with incorrect linking so your code may be correct but you didn't specify the paths to link to the libraries.

Re: Lua Question

Posted: Wed Jul 28, 2010 4:32 am
by MrDeathNote
GRENADIAC111 wrote:Hmm I don't know much about Code::Blocks but this site helped me implement Lua scripts into my engine maybe it can help you. http://gamedevgeek.com/tutorials/gettin ... d-with-lua
Thats a very nice tut, thanks i've bookmarked it for later :)

Re: Lua Question

Posted: Wed Jul 28, 2010 12:15 pm
by dandymcgee
Yeah that's what I used when I first set up Lua. Practically the only decent one available. Definitely worthy of posting.

Re: Lua Question

Posted: Wed Jul 28, 2010 12:21 pm
by Falco Girgis
You're DEFINITELY not linking to the library correctly.

Re: Lua Question

Posted: Sun Aug 08, 2010 12:36 pm
by Lord Pingas
Nah it's fine now.

I just compiled Lua myself into a .a file rather than a .lib and it's working fine. :)

Thanks guys.