ubuntu16.04环境下fatal error: lua.h: No such file or directory

时间:2020-12-22 12:31:57   收藏:0   阅读:0

1.apt-get install liblua5.1-0-dev

2.编辑hello.c

#include "lua.h"
#include "lauxlib.h"
int main(int argc, char **argv)
{
    lua_State *L = luaL_newstate();
    luaL_openlibs(L);
    luaL_dostring(L, "print(‘hello, ‘.._VERSION)");
    return 0;
}

3.gcc -I/usr/include/lua5.1 -o hello hello.c -llua5.1 -lm

4../hello

技术图片



 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!