Reputation: 192
I've got a simple test application I'm trying to build in C++ with Lua (on Linux). The build line looks like this:
g++ -o"LuaTest" ./src/LuaTest.o -l/home/diego/lua-5.1.4/src/liblua.a
And it spits out this error:
/usr/bin/ld: cannot find -l/home/diego/lua-5.1.4/src/liblua.a
Which would be all well and good except that I'm staring liblua.a right in the face in that folder. I tried a similar configuration under Windows using MinGW and the Windows binaries for Lua and shockingly I get the exact same result, only it whines about lua51.lib or lua5.1.lib or whichever file I try.
What am I missing here?
If it matters here's the application:
extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
int main()
{
return 0; //this really should compile -_-
}
Upvotes: 2
Views: 1580
Reputation: 110202
Leave out the -l
. It should be just:
g++ -o"LuaTest" ./src/LuaTest.o /home/diego/lua-5.1.4/src/liblua.a
The -l
switch tells g++ to automatically add the lib
and .a
parts of the filename, and to look for it in the standard library directories - which you don't need here.
Upvotes: 6