Sign in to follow this  
michaelj

Lua C++ error lnk2019

Recommended Posts

michaelj    122
Hello, I just begin to learn Lua, and the first program meet a problem: ------------------------------------------ #include "stdio.h" extern "C"{ #include "lua.h" #include "lualib.h" #include "lauxlib.h" } lua_State* L; int main() { //init Lua L = lua_open(); //load lua base library lua_baselibopen(L); //run the script lua_dofile(L, "test.lua"); //lua_dostring(L, "print 5+10"); //close lua lua_close(L); printf("Hello, I am %s", "the one"); return 0; } ------------------------------------------------ But the VS2003.net output the error message: ---------------------------------------------------------- error LNK2019: unresolved external symbol _lua_dofile ---------------------------------------------------------- Then I search the google and only found this answer: http://207.97.199.221/forums/showthread.php?t=9157 I use the Dependency.exe(VS6.0's tools) and open the lua.dll/lualib.dll, but can't find lua_dostring or lua_dofile functions. So, please help. Thanks in advance!

Share this post


Link to post
Share on other sites
michaelj    122
lua_open() and lua_close() can work through!
But lua_dofile, lua_dostring can't!

I can't find these two functions in lua.dll/lualib.dll. (use dependency.exe to check them)

Share this post


Link to post
Share on other sites
michaelj    122
Quote:
Original post by Sneftel
It's luaL_dofile and luaL_dostring.


when did they change?

But luaL_dofile and luaL_dostring don't exist, either.

I even can't find "dofile" in those dll.

Share this post


Link to post
Share on other sites
Sneftel    1788
They're in lauxlib.

EDIT: actually, nevermind. lua_dofile and lua_dostring should both still be around as compatibility functions in lauxlib.

Share this post


Link to post
Share on other sites
michaelj    122
Quote:
Original post by Sneftel
They're in lauxlib.

EDIT: actually, nevermind. lua_dofile and lua_dostring should both still be around as compatibility functions in lauxlib.


I really don't know what's wrong with it then.

The file name I download from lua.org is: LuaBinaries-5.0.3.zip

I find those functions in lauxlib.h but what about the ".lib" file? and the ".dll" file?

VC++ find them in lauxlib but can't link them because no ".lib" file contain them.

Share this post


Link to post
Share on other sites
Sneftel    1788
It's probable that the binaries you've found (from where? lua.org doesn't host binaries, and the latest released version is 5.0.2) don't include the lauxlib source file.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this