PDA

View Full Version : Lua and VC++


Eltari13
10-17-2004, 05:44 AM
Hi everyone ^^' I am a noob to C++ (just came from BlitzBasic 3d) and I'm trying to implement LUA as a scripting engine that controlls a program in blitz. My idea was to compile all the lua libs into a dll and write a bridge dll that would do all the thinking and just use callback to tell the application what to do. But.. I got stuck on step one. There are several tutorials showing the very basics of implementing LUA but I cant even get the ****ed things to compile when copy-pasted!

The particular tutorial i'm talking about is at http://tonyandpaige.com/tutorials/lua1.html

I did everything as the instructions for the first step said, copy-pasted the code provided, tried to compile it in VC++ 6 and got all this rubbish:

Core.obj : error LNK2001: unresolved external symbol _lua_close
Core.obj : error LNK2001: unresolved external symbol _lua_dofile
Core.obj : error LNK2001: unresolved external symbol _luaopen_base
Core.obj : error LNK2001: unresolved external symbol _lua_open
Debug/Lua testing.exe : fatal error LNK1120: 4 unresolved externals

Um.. Can anyone point me in the right direction?
Thanks in advance ^^'

Worm
10-17-2004, 07:33 AM
Have you added the the Lib and Include folders for LUA to the IDE?

Also have you added lua+lib.lib to Project/Settings/Link Object Library Modules?

The other thing is to be sure to include the lua includes in this manner:

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

Eltari13
10-17-2004, 10:10 AM
Ah, thanks. I was running ahead of myself there and didn't link to the Lua+lib file. However, I had to go off and download it from the link on the site. It's nowhere to be found in the lua release (with included binaries) I got off the official site. Would I need to compile it otherwise? From which files?