VC编译lua库 出现错误:
错误 36 error LNK1120: 21 个无法解析的外部命令 C:\Users\luozhuang\Desktop\onscripter-20120416VC\Release\onscripter.exe onscripter 错误 19 error LNK2019: 无法解析的外部符号 "char const * __cdecl lua_tolstring(struct lua_State *,int,unsigned int *)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: int __thiscall LUAHandler::callFunction(bool,char const *)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 32 error LNK2019: 无法解析的外部符号 "char const * __cdecl luaL_checklstring(struct lua_State *,int,unsigned int *)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" (? [email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 29 error LNK2019: 无法解析的外部符号 "int __cdecl lua_error(struct lua_State *)" ([email protected]@[email protected]@@Z),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 28 error LNK2019: 无法解析的外部符号 "int __cdecl lua_pcall(struct lua_State *,int,int,int)" (? [email protected]@[email protected]@[email protected])。该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" (? [email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 18 error LNK2019: 无法解析的外部符号 "int __cdecl lua_toboolean(struct lua_State *,int)" (? [email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 17 error LNK2019: 无法解析的外部符号 "int __cdecl lua_tointeger(struct lua_State *,int)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 33 error LNK2019: 无法解析的外部符号 "int __cdecl luaL_checkinteger(struct lua_State *,int)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 34 error LNK2019: 无法解析的外部符号 "int __cdecl luaL_loadbuffer(struct lua_State *,char const *,unsigned int,char const *)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" ([email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 35 error LNK2019: 无法解析的外部符号 "struct lua_State * __cdecl luaL_newstate(void)" ([email protected]@[email protected]@XZ)。该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" (? [email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 15 error LNK2019: 无法解析的外部符号 "void __cdecl lua_close(struct lua_State *)" (? [email protected]@[email protected]@@Z)。该符号在函数 "public: __thiscall LUAHandler::~LUAHandler(void)" (? [email protected]@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 26 error LNK2019: 无法解析的外部符号 "void __cdecl lua_getfield(struct lua_State *,int,char const *)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: int __thiscall LUAHandler::callFunction(bool,char const *)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 24 error LNK2019: 无法解析的外部符号 "void __cdecl lua_pushboolean(struct lua_State *,int)" (? [email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 22 error LNK2019: 无法解析的外部符号 "void __cdecl lua_pushinteger(struct lua_State *,int)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" (? [email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 25 error LNK2019: 无法解析的外部符号 "void __cdecl lua_pushlightuserdata(struct lua_State *,void *)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" ([email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 21 error LNK2019: 无法解析的外部符号 "void __cdecl lua_pushnumber(struct lua_State *,double)" ([email protected]@[email protected]@[email protected])。该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 23 error LNK2019: 无法解析的外部符号 "void __cdecl lua_pushstring(struct lua_State *,char const *)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 16 error LNK2019: 无法解析的外部符号 "void __cdecl lua_pushvalue(struct lua_State *,int)" (? [email protected]@[email protected]@[email protected])。该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" ([email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 27 error LNK2019: 无法解析的外部符号 "void __cdecl lua_setfield(struct lua_State *,int,char const *)" (? [email protected]@[email protected]@[email protected]),该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" (? [email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 30 error LNK2019: 无法解析的外部符号 "void __cdecl luaL_openlibs(struct lua_State *)" ([email protected]@[email protected]@@Z)。该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" (? [email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 31 error LNK2019: 无法解析的外部符号 "void __cdecl luaL_register(struct lua_State *,char const *,struct luaL_Reg const *)" ([email protected]@[email protected]@[email protected]@@Z)。该符号在函数 "public: void __thiscall LUAHandler::init(class ONScripter *,class ScriptHandler *)" ([email protected]@@[email protected]@[email protected]@@Z) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter 错误 20 error LNK2019: 无法解析的外部符号 "void const * __cdecl lua_topointer(struct lua_State *,int)" ([email protected]@[email protected]@[email protected]),该符号在函数 "public: bool __thiscall LUAHandler::isCallbackEnabled(int)" ([email protected]@@[email protected]) 中被引用 C:\Users\luozhuang\Desktop\onscripter-20120416VC\LUAHandler.obj onscripter
解决方法:由于是C++项目。EXE引用的lua头文件必须这样写:
extern "C" { #include <lua.h> }
extern "C" { #include <lualib.h> #include <lauxlib.h> }
时间: 2024-10-12 23:52:32