Lua Question

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Lord Pingas
Chaos Rift Regular
Chaos Rift Regular
Posts: 178
Joined: Thu Dec 31, 2009 9:33 am
Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
Programming Language of Choice: C++
Location: Hiding In My Mum's Basement With My Pokemon Cards

Lua Question

Post 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.
User avatar
Zer0XoL
ES Beta Backer
ES Beta Backer
Posts: 54
Joined: Fri Apr 24, 2009 1:18 pm
Current Project: Zelda untitled multiplayer game
Favorite Gaming Platforms: PC, GBA, N64
Programming Language of Choice: C++, Lua
Location: Sweden
Contact:

Re: Lua Question

Post 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
Image
Im Blue
User avatar
Lord Pingas
Chaos Rift Regular
Chaos Rift Regular
Posts: 178
Joined: Thu Dec 31, 2009 9:33 am
Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
Programming Language of Choice: C++
Location: Hiding In My Mum's Basement With My Pokemon Cards

Re: Lua Question

Post 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.
GRENADIAC111
ES Beta Backer
ES Beta Backer
Posts: 10
Joined: Wed Jul 21, 2010 2:40 am
Favorite Gaming Platforms: PS2, PC, NES
Programming Language of Choice: C++, AS3

Re: Lua Question

Post 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
User avatar
WSPSNIPER
Chaos Rift Regular
Chaos Rift Regular
Posts: 145
Joined: Sun Jan 03, 2010 6:19 pm
Current Project: top down shooter
Favorite Gaming Platforms: ps3
Programming Language of Choice: c++

Re: Lua Question

Post 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
User avatar
dejai
Chaos Rift Junior
Chaos Rift Junior
Posts: 207
Joined: Fri Apr 11, 2008 8:44 pm

Re: Lua Question

Post 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.
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: Lua Question

Post 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 :)
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Lua Question

Post by dandymcgee »

Yeah that's what I used when I first set up Lua. Practically the only decent one available. Definitely worthy of posting.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Lua Question

Post by Falco Girgis »

You're DEFINITELY not linking to the library correctly.
User avatar
Lord Pingas
Chaos Rift Regular
Chaos Rift Regular
Posts: 178
Joined: Thu Dec 31, 2009 9:33 am
Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
Programming Language of Choice: C++
Location: Hiding In My Mum's Basement With My Pokemon Cards

Re: Lua Question

Post 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.
Post Reply