lua-users home
lua-l archive

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


The first error is a link error, the second is a compilation error.
 
You have the compilation error because luaL_newstate takes no parameter, and gcc can tell that from lua.h.
 
The compilation error may have several sources. It may appear if you forget to link with the lua libs (add -llualib and -llua options to your link command). If that's already done check that you link against the correct version of the libs.


De : lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] De la part de Ricardo Sarmento
Envoyé : 15 septembre 2006 15:01
À : lua@bazar2.conectiva.com.br
Objet : problem using luaL_newstate

Hi,

The case is:

If I use the correct syntax:

lua_State *L=luaL_newstate();

I get the follow error:

/root/Ricardo/Outros/Lua/Kdevelop/teste/src/main.cpp:80: undefined reference to `luaL_newstate'

It seems like I haven't linked the correct library, but if I use the wrong syntax:

lua_State *L=luaL_newstate("something");

I get the follow error:

/usr/local/include/lauxlib.h:82: error: too many arguments to function ?lua_State* luaL_newstate()?

Then, I'm confuse: If the library is wrongly linked, gcc wouldn't know how much arguments are asked by luaL_newstate, right?

Did I forget something to look for?

Thanks all.

--

Ricardo Sarmento