lua-users home
lua-l archive

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


frcecin@terra.com.br wrote:
Hi. I'm using Visual C++ 6 and trying to compile a very simple program
that makes use of the Lua precompiled binaries for Windows/VC6:

#include <lua.h>
int main() { lua_State *s = lua_open(256);
  return 0;
}

The VC6 linker complains that it can't find lua_open():

lua.obj : error LNK2001: unresolved external symbol "struct lua_State * __cdecl lua_open(int)" (?lua_open@@YAPAUlua_State@@H@Z)
Debug/lua.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


Looks like you got bitten by the C++ name mangling.

Try the following change:
----------
extern "C" {
#include <lua.h>
}

int main() {
  lua_State *s = lua_open(256);
  return 0;
}
------------

If this doesn't help, then it is time to
check other things. I personally include lua into
my project by adding the source files to to the VC
project. Because of their small size, I have
never felt any need to use a .lib for Lua.

		Eero