cannot find -llua ....... embedding c++ with Lua...

Status
Not open for further replies.

knowledge_Seeker1

Newbie level 6
Joined
Jan 22, 2012
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,382
I am trying to embed C++ with Lua.

I downloaded the lua-5.2.0 and named the folder /lua-5.2.0/

In order to install it, I switched to the /lua-5.2.0/ in the Terminal and Ran the following comand:

...../lua-5.2.0$ make linux test

This folder has a /src/ folder

I created a simple clua.cpp code inside the src folder

PS:i copied pasted the code from the internet

the clua.cpp file has the following code:


Code:
extern "C" {
   #include <stdio.h>

#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"  /* the Lua interpreter */
#include <stdlib.h>
}

int
main(void)
{
    int status, result, i;
    double sum;
    lua_State *L;

    /*
     * All Lua contexts are held in this structure. We work with it almost
     * all the time.
     */
    L = luaL_newstate();

    luaL_openlibs(L); /* Load Lua libraries */

    /* Load the file containing the script we are going to run */
    status = luaL_loadfile(L, "script.lua");
    if (status) {
        /* If something went wrong, error message is at the top of */
        /* the stack */
        fprintf(stderr, "Couldn't load file: %s\n", lua_tostring(L, -1));
      exit(1);
    }
}

When I ran the following command to run the program,
Code:
g++ clua.cpp -o output -llua



I get the following error
Code:
/usr/bin/ld: cannot find -llua
collect2: ld returned 1 exit status


I am a LUA newbie and i have been getting headaches since early morning because i have googled this problem and

cant seem to fix this error !
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…