Lua help

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
Ewan
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Mon Mar 23, 2009 11:46 am

Lua help

Post by Ewan »

Well, yet again my linker's giving me crap. I've downloaded the source code for this tutorial: http://www.gamedev.net/reference/progra ... efault.asp (thanks M_D_K). I'm linking to lualib.lib and lualib_dbg.lib, and in my Search Directories I have lib and include, in compiler and linker respectively.

Running this

Code: Select all

#include <lua.h>

int main(int argc, char* argv[])
{
	lua_State* L = lua_open(0);
	lua_close(L);
	return 0;
}
gives me undefined references to both lua functions.
obj\Debug\main.o||In function `main':|
C:\Documents and Settings\Ewan\Desktop\Code Blocks\luatest\Lua\main.cpp|5|undefined reference to `lua_open(int)'|
C:\Documents and Settings\Ewan\Desktop\Code Blocks\luatest\Lua\main.cpp|6|undefined reference to `lua_close(lua_State*)'|
||=== Build finished: 2 errors, 0 warnings ===|
The guy in the tut says to use extern "C" around your includes but that just gives me a bunch of DIFFERENT errors..

Code: Select all

extern "C"
{
    #include <lua.h>
}

int main(int argc, char* argv[])
{
	lua_State* L = lua_open(0);
	lua_close(L);
	return 0;
}
||Info: resolving __iob by linking to __imp___iob |
||Info: resolving __pctype by linking to __imp___pctype |
||Info: resolving ___mb_cur_max by linking to __imp____mb_cur_max |
||warning: auto-importing has been activated without --enable-auto-import specified on the command line.|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBC" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
fu000001.o:(.idata$2+0xc)||undefined reference to `_libmsvcrt_a_iname'|
fu000004.o:(.idata$2+0xc)||undefined reference to `_libmsvcrt_a_iname'|
fu000005.o:(.idata$2+0xc)||undefined reference to `_libmsvcrt_a_iname'|
fu000006.o:(.idata$2+0xc)||undefined reference to `_libmsvcrt_a_iname'|
fu000008.o:(.idata$2+0xc)||undefined reference to `_libmsvcrt_a_iname'|
nmth000000.o:(.idata$4+0x0)||undefined reference to `__nm___iob'|
nmth000007.o:(.idata$4+0x0)||undefined reference to `__nm___pctype'|
nmth000017.o:(.idata$4+0x0)||undefined reference to `__nm____mb_cur_max'|
||=== Build finished: 8 errors, 18 warnings ===|
Any help would be greatly appreciated :)
They pull out the truncheon, that's when the trouble starts.

'Cause when you've got a badge, the laws don't apply.
User avatar
Joeyotrevor
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Thu Jan 22, 2009 6:24 pm
Programming Language of Choice: C++

Re: Lua help

Post by Joeyotrevor »

You have to put quotes around lua.h instead of brackets.

Code: Select all

eb 0c 48 65 6c 6c 6f 20 77 6f 72 6c 64 21 31 d2 8e c2 30 ff b3 0a bd 02 7c b9 0b 00 b8 00 13 cd 10 eb fe
Ewan
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Mon Mar 23, 2009 11:46 am

Re: Lua help

Post by Ewan »

Joeyotrevor wrote:You have to put quotes around lua.h instead of brackets.
Thanks, I figured that out but now I get this:

Image

"The application has failed to start because MSVCR90.dll was not found. Re-installing the application may fix this problem."

Any clues? :x

Edit: I'm guessing it's something to do with the fact that I compiled the Lua libraries with VS, because when I downloaded them they were in VS project form..
They pull out the truncheon, that's when the trouble starts.

'Cause when you've got a badge, the laws don't apply.
User avatar
dani93
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 38
Joined: Mon Apr 13, 2009 9:38 am
Location: Austria

Re: Lua help

Post by dani93 »

You need the M$-C-Runtime-Library. Isn't it included with VS? Sorry, I can't give you further information cause I don't use VS (gcc ;) ). Maybe it is because you didn't create the project yourself. Look for the dll in the Windows-directory.
If you can't find it you can download it from here.
Or create a new project and copy the code.
Ewan
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Mon Mar 23, 2009 11:46 am

Re: Lua help

Post by Ewan »

dani93 wrote:You need the M$-C-Runtime-Library. Isn't it included with VS? Sorry, I can't give you further information cause I don't use VS (gcc ;) ). Maybe it is because you didn't create the project yourself. Look for the dll in the Windows-directory.
If you can't find it you can download it from here.
Or create a new project and copy the code.
Thanks, I've now got the compiled libraries for Windows from the Lua site and it seems to be working fine.
They pull out the truncheon, that's when the trouble starts.

'Cause when you've got a badge, the laws don't apply.
Post Reply