lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

  I am statically linking my classes, and I realized I was using the wrong version of Lua (5.1) so it was working, but now I get these errors when I use Lua 5.2

 

error LNK2019: unresolved external symbol _lua_tonumber referenced

error LNK2019: unresolved external symbol _lua_tointeger referenced

error LNK2019: unresolved external symbol _lua_pcall

error LNK2019: unresolved external symbol _luaL_loadfile referenced

 

What is odd is that this is a snippet of what I am doing:

  lua_pushnumber(L, 1.1);

  lua_setglobal(L, "cppvar");

 

  if (lua_pcall(L,0, LUA_MULTRET, 0)) {

    lua_pop(L,1);

  }

 

  lua_getglobal(L, "luavar");

  double luavar = lua_tonumber(L,-1);

  lua_pop(L,1);

  lua_getglobal(L, "delaysecs");

  delaySecs = lua_tointeger(L, -1);

  lua_pop(L, 1);

 

So lua_pop, lua_getglobal, lush_pushnumber for example link fine, so it appears I am loading the correct library.

 

Any idea what I may look at to see why this is messing up for me?

 

This is how I build my lib files:

cl /MD /O2 /W3 /c /DLUA_BUILD_AS_DLL /DLUA_COMPAT_MODULE *.c

del *.o

ren lua.obj lua.o

ren luac.obj luac.o

link /DLL /IMPLIB:lua5.2.lib /OUT:lua5.2.dll *.obj

ren lua.o lua.obj

lib /out:lua5.2-static.lib *.obj 

 

 

The difference between lua5.2.lib and 5.2-static.lib is the second one includes lua.obj