首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 其他开发语言 >

vc2008 运行 lua5.1脚本,该怎么解决

2012-02-16 
vc2008运行 lua5.1脚本#include stdio.hextern C {#include lua.h#include lualib.h#include lau

vc2008 运行 lua5.1脚本
#include <stdio.h>

extern "C" {  
#include "lua.h"  
#include "lualib.h"  
#include "lauxlib.h"  
}  
lua_State* L;
int main(void)
{
   
  L = luaL_newstate();
  luaL_openlibs(L);

  luaL_dofile(L,"vs_lua_Test.lua");
  lua_close(L);

  return 0;
}


出现下面这些错误

Win32 ------
1>Compiling...
1>test.cpp
1>Linking...
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl lua_close(struct lua_State *)" (?lua_close@@YAXPAUlua_State@@@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "int __cdecl lua_pcall(struct lua_State *,int,int,int)" (?lua_pcall@@YAHPAUlua_State@@HHH@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "int __cdecl luaL_loadfile(struct lua_State *,char const *)" (?luaL_loadfile@@YAHPAUlua_State@@PBD@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "void __cdecl luaL_openlibs(struct lua_State *)" (?luaL_openlibs@@YAXPAUlua_State@@@Z) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "struct lua_State * __cdecl luaL_newstate(void)" (?luaL_newstate@@YAPAUlua_State@@XZ) referenced in function _ma

搞了很久,搞不定,能告诉咋搞吗?


[解决办法]
#include "luaconf.h" //这个很关键
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"


[解决办法]
还要连接相关的库
lua51.lib

热点排行