Lua - initializing

Posted by Ockonal on Stack Overflow See other posts from Stack Overflow or by Ockonal
Published on 2010-03-14T07:36:37Z Indexed on 2010/03/14 7:45 UTC
Read the original article Hit count: 229

Filed under:
|

Hello, I can't init lua correctly under Arch Linux. Lua - latest version. Here is my code:

#include <stdio.h>
extern "C"
{
    #include <lua.h>
    #include <lauxlib.h>
    #include <lualib.h>
}

int main()
{
    lua_State *luaVM = luaL_newstate();
    if (luaVM == NULL)
    {
        printf("Error initializing lua!\n");
        return -1;
    }

    luaL_openlibs(luaVM);
    lua_close(luaVM);

    return 0;
}

/tmp/cc0iJ6lW.o: In function main': test_lua.cpp:(.text+0xa): undefined reference toluaL_newstate'

test_lua.cpp:(.text+0x34): undefined reference to `luaL_openlibs'

test_lua.cpp:(.text+0x40): undefined reference to `lua_close' collect2: ld

returned 1 exit status

What's wrong?

© Stack Overflow or respective owner

Related posts about lua

Related posts about c++