[toLua] Generated files fail to compile

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
vimes
Gnoblar
Posts: 15
Joined: Fri May 19, 2006 5:00 am

[toLua] Generated files fail to compile

Post by vimes »

Hi, I'm using LUA and to LUA to create the GUI of a project using Ogre and CEGUI.
Here is what I want to do : I want a function in a LUA script to call a C++ function in my GameEngine class.
I cleaned the Gameengine.h file, renamed it to LUAGameEngine.pkg and generated the LUAGameEngine.cpp and LUAGameEngine.h file thanks to this command

Code: Select all

tolua+ -H LUAGameEngine.h -o LUAGameEngine.cpp LUAGameEngine.pkg

here is the generated LUAGameEngine.h

Code: Select all

/*
** Lua binding: LUAGameEngine
** Generated automatically by tolua++-1.0.7 on 06/08/06 07:54:45.
*/
/* Exported function */
TOLUA_API int  tolua_LUAGameEngine_open (lua_State* tolua_S);
When I add LUAGameEngine.h and LUAGameEngine.cpp to my project, add

Code: Select all

tolua_LUAGameEngine_open(scriptmod->getLuaState());
to bind the class and try to compile I get this error from Visual Studio Express

Code: Select all

c:\documents and settings\dave\desktop\workingoutput\source\globalmain\code\luagameengine.h(7) : error C2144: syntax error : 'int' should be preceded by ';'
c:\documents and settings\dave\desktop\workingoutput\source\globalmain\code\luagameengine.h(7) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I tried to used the cleaned header instead of the generated one but then I couldn't access the tolua_LUAGameEngine_open function...
I really don't know what to do next... if someone could to a robust tutorial, provide an example or even pinpoint where I'm making a mistake, I''ll be very grateful 'cos this is the last thing standing between me and getting my GUI right :)
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

You should ask the toLua maintainers about problems compiling with toLua -- this is neither an Ogre question nor a "Back To Basics" question.
vimes
Gnoblar
Posts: 15
Joined: Fri May 19, 2006 5:00 am

Post by vimes »

xavier wrote:You should ask the toLua maintainers about problems compiling with toLua -- this is neither an Ogre question nor a "Back To Basics" question.
Sorry if this post doesn't fit this particular forum but I already tried to contact the maintainers without success and my posts on CEGUi forum and on Gamedev are on hold. I figured it wouldn't hurt a bit if I posted on the OGRE forums, since people are more and more using scripting and more particularly LUA.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

Not sure that is so true; seems like a lot of people around here shunned Lua in favor of whatever niche scripting language was popular that week. We use Lua, but not toLua -- just the straight Lua interpreter. IMO toLua and lua++ build problems are one of those things that so few people use them, you are better off figuring it out on your own rather than wait for someone to answer.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I think that you should check that your preprocessor knows what TOLUA_API means, because maybe it doesn't. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply