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


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

5.发现报错

修改hello.c

#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"  

int main(int argc, char **argv)
{
    lua_State *L = luaL_newstate();
    luaL_openlibs(L);
    luaL_dostring(L, "print('hello, '.._VERSION)");
    return 0;
}

 



 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM