lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I copied the following code from the lua tutorial sent a few days ago:

#include <stdio.h> 
#include <lua.h>
#include <lualib.h>

int main(int argc, char* argv[ ]) 
{ 
lua_State* luaVM = lua_open(0);

 
if (NULL == luaVM) { printf("Error Initializing lua\n"); return -1; 
}
lua_baselibopen(luaVM); 
lua_iolibopen(luaVM); 
lua_strlibopen(luaVM); 
lua_mathlibopen(luaVM);
 // Do stuff with lua code.
 
  char* strLuaInput = "a = 1 + 1;\n print(a);\n";
  
   lua_dostring(luaVM, strLuaInput);
   
    lua_close(luaVM); 
    
     return 0; 
}
     
and  i got this:

/tmp/ccI7aU6p.o: In function `main':
/tmp/ccI7aU6p.o(.text+0x20): undefined reference to `lua_baselibopen'
/tmp/ccI7aU6p.o(.text+0x28): undefined reference to `lua_iolibopen'
/tmp/ccI7aU6p.o(.text+0x30): undefined reference to `lua_strlibopen'
/tmp/ccI7aU6p.o(.text+0x38): undefined reference to `lua_mathlibopen'