int main(int argc, char *argv[]) { // Open Lua virtual machine lua_State* luaVM = lua_open(); if (NULL == luaVM) { cout << "Error Initializing lua\n" << endl; return; } cout << "Lua is inicialized" << endl; // Close Lua virtual machine lua_close(luaVM); return 0; }
Now we add the Lua library to the makefile LOADLIBES = -lauxlib -llua
-llualib -ldl
or compile g++ -o
test test.cpp -L/usr/lib -lauxlib -llua
-llualib -ldl