lua-users home
lua-l archive

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

Luckily enough for you, C++ decorates its names with funky characters,
because of overloading (two methods can have the same name, you don't want
to create linkage conflicts). Lua is not C++, it is C and thusly does not
use name decoration. To get around this, simply include the Lua header as

extern "C"
#include "lua.h"

This forces the C++ compiler to realize that the Lua functions should not be
decorated when checking for linkage.


----- Original Message -----
From: "John S. Miley" <>
To: "Multiple recipients of list" <>
Sent: Wednesday, November 21, 2001 11:31 AM
Subject: Silly question

> Sorry to bother you folks, but I'm having a bit of trouble linking a
> skeleton app I'm working on, and the (I'm sure) obvious answer is eluding
> at the moment.
> I've specified lua.lib and lualib.lib to be linked in with the app, and am
> #including "lua.h"; upon compiling, I'm getting this error:
> Linking...
> LuaTest.obj : error LNK2001: unresolved external symbol "void __cdecl
> lua_close(struct lua_State *)" (?lua_close@@YAXPAUlua_State@@@Z)
> LuaTest.obj : error LNK2001: unresolved external symbol "struct lua_State
> __cdecl lua_open(int)" (?lua_open@@YAPAUlua_State@@H@Z)
> Debug/LuaTest.exe : fatal error LNK1120: 2 unresolved externals
> Thanks for your time!
> --jsm