(no subject)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

chagbinary
i must be missing something here, because no one else seems to have this problem.  i just cant figure out how to initalize Lua 3.2 or 4.0.
 
the statement
    "lua_State *L = lua_newstate(NULL);"
brings about
    "unresolved external symbol "struct lua_State * __cdecl lua_newstate(char const *,...)""
 
when it reaches the linker.  i've tried both linking to the prebuilt libs and just including the source into my code (\lua\src, \lua\src\lib, \lua\include).
 
 
also, does anyone have a Lua 4.0 DLL?  (MSVC 6)
 
 
charlie
Reply | Threaded
Open this post in threaded view
|

RE: unresolved external

Ashley Fryer-2
> the statement
>    "lua_State *L = lua_newstate(NULL);"
> brings about
>    "unresolved external symbol "

Lua is written in C, and you're probably trying to use it in C++, which
means you have to use extern "C" when including the Lua headers.  For
example:

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

Regards,
ashley



Reply | Threaded
Open this post in threaded view
|

RE:

Vincent Penquerc'h-2
In reply to this post by chagbinary
> the statement
>     "lua_State *L = lua_newstate(NULL);"
> brings about
>     "unresolved external symbol "struct lua_State * __cdecl
lua_newstate(char const *,...)""

Depending on the settings (LUA_REENTRANT), lua_State gets declared or not.
When reentrant, it is not emitted, as it is assumed that people will supply
their
own states to the Lua API. If you still want to use it, you will need to put
it
in one of your source files, or compile Lua in non reentrant mode.

--
Lyrian

Reply | Threaded
Open this post in threaded view
|

RE: unresolved external

Vincent Penquerc'h-2
In reply to this post by Ashley Fryer-2
> > the statement
> >    "lua_State *L = lua_newstate(NULL);"
> > brings about
> >    "unresolved external symbol "
> 
> Lua is written in C, and you're probably trying to use it in C++, which
> means you have to use extern "C" when including the Lua headers.  For
> example:

Oops, sorry, I misread the message. I thought the unresolved
external was lua_State. Sorry for the noise

-- 
Lyrian