lua-users home
lua-l archive

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

You may need to do

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

if you're compiling in C++ mode.

By the way, how come lua API header files do not properly handle the case of a C++ compiler ? Isn't it standard to check __cplusplus__ ?

Vincent Penne

Wolfgang Bujatti wrote:

Thanks, I deleted the '0'

The errror I'm always getting is:
[Linker error] undefined reference to 'lua_open'

Also I recognized, that the devpack for Lua 5.0 has no dll and that for
LuaPlus has one, which is saved under folder C:\Dev-Cpp\DLL

So, is there no need for a dll with Lua 5.0? And when it is needed, where
should I put it, so that Dev-C++ can find it?

I put some Lua Binaries in another folder, and put this in the Windows PATH,
but this didn't work either.

Thanks for helping, to get it - hopefully - up and running,

-----Original Message-----
[]On Behalf Of Jason Murdick
Sent: Monday, March 21, 2005 1:07 AM
To: Lua list
Subject: Re: Hello World

In Lua 5.0 lua_open does not take any arguments.  That was changed
from Lua 4.x in which lua_open did.

- Jason

On Sun, 20 Mar 2005 21:40:46 +0100, Wolfgang Bujatti
<> wrote:

I really cannot get my Lua up and running.
Using Dev-C++ (MinGW) with the prepared devpacks of Lua 5.0 and a standard
ANSI C file (have also LuaPlus, but even more errors).

#include <stdio.h>
#include <lua.h>

int main(int argc, char* argv[ ])
 lua_State* luaVM = lua_open(0);

 if (NULL == luaVM)
    printf("Error Initializing lua\n");
    return -1;

 // Do stuff with lua code.

 lua_close( luaVM );

 return 0;

I get the error: too many arguments in function 'lua open'

Can anyone help me getting this up and running or supply me with a simple
hello world program.

Thanks in advance,