knowledge_Seeker1
Newbie level 6
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:
When I ran the following command to run the program,
I get the following error
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 !
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 !