我尝试使用 valac 编译器在 Ubuntu 14.04 中编译一个 vala 文件,并且:
$ valac -X "-I/usr/include/lua5.2" --pkg lua --pkg gtk+-3.0 main.vala
/home/gabriel/Documents/opera/cpp/tisserand/src/main.vala.c: In function ‘main’:
/home/gabriel/Documents/opera/cpp/tisserand/src/main.vala.c:156:2: warning: ‘g_type_init’ is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:667) [-Wdeprecated-declarations]
g_type_init ();
^
/tmp/ccX2zHVb.o: In function `on_click':
main.vala.c:(.text+0x7c): undefined reference to `luaL_loadstring'
main.vala.c:(.text+0xa7): undefined reference to `lua_pcallk'
/tmp/ccX2zHVb.o: In function `invert':
main.vala.c:(.text+0x153): undefined reference to `lua_tolstring'
main.vala.c:(.text+0x189): undefined reference to `lua_pushstring'
/tmp/ccX2zHVb.o: In function `_vala_main':
main.vala.c:(.text+0x25a): undefined reference to `luaL_newstate'
main.vala.c:(.text+0x279): undefined reference to `lua_close'
main.vala.c:(.text+0x2ab): undefined reference to `luaL_openlibs'
main.vala.c:(.text+0x2cc): undefined reference to `lua_pushcclosure'
main.vala.c:(.text+0x2dd): undefined reference to `lua_setglobal'
collect2: error: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
我已经安装了 liblua 5.2并且/usr/include/lua5.2
有lauxlib.h
、lua.h
、lua.hpp
和. 有什么遗漏吗?luaconf.h
lualib.h