I'm trying to set up LUA scripts in my hub soft, so I made a new project just so I understand how to do it, without rendering my hubsoft useless by f***ing it up.
So with this new project I put all the .h and .c files into one folder(to make it easier) and use...
extern "C"{
#include "lua-5.0.2\lua.h"
#include "lua-5.0.2\lualib.h"
}
... to include the files needed to use LUA
now that I have done that, I tested to see if it would build. It does sucessfully
So then I try to just get it to run a simple peice of code a user puts in like so...
void __fastcall TMainForm::Button1Click(TObject *Sender)
{
lua_State * L;
const char * str;
str = Code->Lines->Text.c_str();
lua_dostring(L, str);
}
And i get this error when trying to build...
[Linker Error] Unresolved external '_lua_dostring' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\LUA TEST\MAIN.OBJ
?(
Ok so I thought this function was dodgy, so I tryed others ones aswel like lua_dobuffer(); I get the same errors? all the time, when ever I try to use a function.
Same with the wrapper I use OR_LUA
Any ideas?
PS: Did i put this thread in the right place? I wasn't too sure :))
You have to include the lua source either as:
1) An additional library that statically links (often done by adding another project)
2) An additional library that dynamically links (compile lua into a dll and get the .lib)
-NotRabidWombat
Humm I have done that, but i still get the damn errror. Maby I'm not doing it right?
Well, which method have you chosen.
I typically use Visual Studio, so I'm not sure how you would include a library to a project. In VS, this information is in the project settings/preferences under linking.
If you are doing it properly, there should a be lua.lib somewhere in the build area.
-NotRabidWombat
what happens if you put the .h files in the same directory as the rest of your project ?
That's irrelevant. He would have compiling (missing included header) errors if the header file could not be found. As the first post says, he's getting linking errors.
-NotRabidWombat