lua-users home
lua-l archive

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


Using tolua, is the basic idea to create wrapper source and header files for all
classes that I want to export to Lua, and then add these wrappers into my
project? Is that pretty much it?

I have baseObject.h:

#ifndef _BASEOBJECT_H__
#define _BASEOBJECT_H__
class baseObject  
{
public:
	baseObject();
	virtual ~baseObject();
};
#endif

And I have baseObject.cpp:

#include "baseObject.h"

baseObject::baseObject()
{
}

baseObject::~baseObject()
{
}

And I have baseObject.pkg:

$#include "baseObject.h"

class baseObject  
{
	baseObject();
	virtual ~baseObject();
};

My comand line for running tolua is:

tolua -o baseObject_lua.C -H baseObject_lua.hxx baseObject.pkg

I add the resulting files into my VC6 project and compile, and I get the
following errors:

d:\development\pr4\lua1\baseobject.h(12) : error C2061: syntax error :
identifier 'baseObject'
d:\development\pr4\lua1\baseobject.h(12) : error C2059: syntax error : ';'
d:\development\pr4\lua1\baseobject.h(13) : error C2449: found '{' at file scope
(missing function header?)
d:\development\pr4\lua1\baseobject.h(18) : error C2059: syntax error : '}'
D:\development\pr4\lua1\baseObject_lua.C(30) : error C2065: 'baseObject' :
undeclared identifier
D:\development\pr4\lua1\baseObject_lua.C(30) : error C2065: 'toluaI_ret' :
undeclared identifier
D:\development\pr4\lua1\baseObject_lua.C(30) : error C2059: syntax error : ')'
D:\development\pr4\lua1\baseObject_lua.C(50) : error C2065: 'self' : undeclared
identifier
D:\development\pr4\lua1\baseObject_lua.C(50) : error C2059: syntax error : ')'
D:\development\pr4\lua1\baseObject_lua.C(52) : error C2065: 'delete' :
undeclared identifier
D:\development\pr4\lua1\baseObject_lua.C(52) : error C2146: syntax error :
missing ';' before identifier 'self'
D:\development\pr4\lua1\baseObject_lua.C(63) : error C2059: syntax error : ')'
D:\development\pr4\lua1\baseObject_lua.C(64) : error C2146: syntax error :
missing ';' before identifier 'self'
D:\development\pr4\lua1\baseObject_lua.C(72) : warning C4013: 'toluaI_reg_types'
undefined; assuming extern returning int

Error executing cl.exe.
baseObject_lua.obj - 13 error(s), 1 warning(s)

I've been reading through the project files for Doris
(http://sourceforge.net/projects/doris/) and I'm sure I'm on the right track.
I'm sure there's something obvious I'm missing, so if anyone could possibly
point out what I'm doing wrong, I'd be most grateful.

Many thanks
Mike