New_Irr example...compile errors

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

New_Irr example...compile errors

Post by MikeR »

Error Message:
C:\Irrlicht_examples\new_irr\new_irr\NewtonGame.h(3 8) : warning C4183: 'MainLoop': missing return type; assumed to be a member function returning 'int'
C:\Irrlicht_examples\new_irr\new_irr\NewtonGame.h(6 5) : error C2143: syntax error : missing ',' before '*'
Process terminated with status 1 (0 minutes, 3 seconds)
13 errors, 12 warnings
Here's the line it calls out:

Code: Select all

static dFloat  OnJumpRayCastPlacement (const NewtonBody* body, const dFloat* normal, int collisionID, void* userData, dFloat intersetParam);
I don't see where anything is missing.

I have tried adding a comma after static dFloat but it had no effect.
Last edited by MikeR on Thu Sep 15, 2005 2:31 am, edited 1 time in total.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

which program is this, and where did you get it?

If its the one from me, dhenton9000, then I'm probably the only one who'll know what you are referring to?


I've only gotten this to compile under VC++ 6. Maybe you've got some kind or reserved word that VC doesn't have (normal????)
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

This is the one you did.
I'm using vc toolkit 2003 with codeblocks as the ide. I got merciors tut to compile with only 1 warning.
I'm doing a test compile to get my compiler setup correctly for this example. I haven't changed any of your code.

Here is the whole code block...

NewtonPlayerController.h

Code: Select all

protected:



static dFloat  OnJumpRayCastPlacement (const NewtonBody* body, const dFloat* normal, int collisionID, void* userData, dFloat intersetParam);
float FindFloor (const vector3df pos);
int   BeginContactHandler(const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1);
void  FinishContactHandler(const NewtonMaterial* material);
int   ProcessContactHandler(const NewtonMaterial* material, const NewtonContact* contact);
void  SetPlayerMeshTransformEventHandler(const NewtonBody* body, const float* matrix);
void  ApplyPlayerForceEventHandler(const NewtonBody* body);
scene::IAnimatedMesh* m_iMeshPlayer;
scene::ICameraSceneNode* m_camera;
scene::ICameraSceneNode* m_rev_camera;
scene::ICameraSceneNode* m_follow_camera;
gui::IGUIStaticText* m_positionText;
scene::ISceneManager* m_mgr;
ISceneNode* m_playerNode;
bool m_hitStair;
void   createNewtonPlayer();
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

I wonder if the compiler somehow handles static keyword differently.
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

I don't know. It should work the same.
Which lib file did you link to?
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
FlyHigh
Posts: 111
Joined: Wed Mar 23, 2005 12:05 am

Post by FlyHigh »

The error means it probably didn't have a declaration for dFloat. You tried forward declareing it and including all nessecary files?
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

That part is in the beginning of the protected part of the class:

Code: Select all

class CNewtonPlayerController  :public CNewtonBase
{
public:
	void changeCamera(IGUIStaticText* statusText);

CNewtonPlayerController();
virtual ~CNewtonPlayerController();

static int  _cdecl BeginContact (const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1);
static void _cdecl FinishContact (const NewtonMaterial* material);
static int  _cdecl ProcessContact (const NewtonMaterial* material, const NewtonContact* contact);
static void _cdecl SetPlayerMeshTransformEvent(const NewtonBody* body, const float* matrix);
static void _cdecl ApplyPlayerForceEvent (const NewtonBody* body);
void Init(ISceneManager *mgr,NewtonWorld* world,KeyItem* keys);
void createPositionText(gui::IGUIStaticText* posText);




protected:



static dFloat OnJumpRayCastPlacement(const NewtonBody* body, const dFloat* normal, int collisionID, void* userData, dFloat intersetParam);
float FindFloor(const vector3df pos);
int   BeginContactHandler(const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1);
void  FinishContactHandler(const NewtonMaterial* material);
int   ProcessContactHandler(const NewtonMaterial* material, const NewtonContact* contact);
void  SetPlayerMeshTransformEventHandler(const NewtonBody* body, const float* matrix);
void  ApplyPlayerForceEventHandler(const NewtonBody* body);
scene::IAnimatedMesh* m_iMeshPlayer;
scene::ICameraSceneNode* m_camera;
scene::ICameraSceneNode* m_rev_camera;
scene::ICameraSceneNode* m_follow_camera;
gui::IGUIStaticText* m_positionText;
scene::ISceneManager* m_mgr;
ISceneNode* m_playerNode;
bool m_hitStair;
void   createNewtonPlayer();
dHenton said that it compiled fine for him with vc6. That's why I wonder which dll he linked to.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

I dont know, I think that dFloat thing might be something. I usually get this kind of error when theres a missing declaration, I think dFloat is defined for Newton, anyway, replace it with its real meaning (float I think) and see what happens.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I'm using Newton, too, and had no problems with it !!!

Did you include "stdlib.h" !?!?!
(Ans using namespace std)

dFloat is declared like this:

Code: Select all

//#define _NEWTON_DOUBLE_PRECISION__
#ifdef _NEWTON_DOUBLE_PRECISION__
	typedef double dFloat;
#else
	typedef float dFloat;
#endif
So you can use double or float instead....
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

I don't find that lib anywhere. Where did you find it?
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

I took your code above and made a header. Added it to the project and added "using namespace std;
Project : newt7
Compiler : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : E:\myEngine\Irrlicht_examples\newirr\newirr\
--------------------------------------------------------------------------------
Switching to target: newt7 - Win32 Release
DamageTrigger.cpp
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonBox.h(28) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonSliderDoor.h(46) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonElevator.h(38) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\IrrlichtSwitch.h(29) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(57) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(58) : warning C4183: 'Prepare': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(59) : warning C4183: 'Finish': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(64) : warning C4183: 'Render': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(65) : warning C4183: 'MainLoop': missing return type; assumed to be a member function returning 'int'
ElevatorSwitch.cpp
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonBox.h(28) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\IrrlichtSwitch.h(29) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
FloatTrigger.cpp
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonBox.h(28) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonSliderDoor.h(46) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonElevator.h(38) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\IrrlichtSwitch.h(29) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(57) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(58) : warning C4183: 'Prepare': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(59) : warning C4183: 'Finish': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(64) : warning C4183: 'Render': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(65) : warning C4183: 'MainLoop': missing return type; assumed to be a member function returning 'int'
IrrlichtSwitch.cpp
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonBox.h(28) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\IrrlichtSwitch.h(29) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonSliderDoor.h(46) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonElevator.h(38) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(57) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(58) : warning C4183: 'Prepare': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(59) : warning C4183: 'Finish': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(64) : warning C4183: 'Render': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(65) : warning C4183: 'MainLoop': missing return type; assumed to be a member function returning 'int'
IrrlichtSwitch.cpp(92) : warning C4244: 'argument' : conversion from 'int' to 'const irr::f32', possible loss of data
MaterialData.cpp
MountedElevator.cpp
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonElevator.h(38) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonElevator.h(69) : error C2146: syntax error : missing ';' before identifier 'OnInitRayCast'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonElevator.h(69) : error C2143: syntax error : missing ',' before '*'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonElevator.h(69) : warning C4183: 'OnInitRayCast': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonBox.h(28) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonSliderDoor.h(46) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\IrrlichtSwitch.h(29) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(57) : warning C4183: 'Init': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(58) : warning C4183: 'Prepare': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(59) : warning C4183: 'Finish': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(64) : warning C4183: 'Render': missing return type; assumed to be a member function returning 'int'
e:\myEngine\Irrlicht_examples\newirr\newirr\NewtonGame.h(65) : warning C4183: 'MainLoop': missing return type; assumed to be a member function returning 'int'
Process terminated with status 1 (0 minutes, 23 seconds)
2 errors, 40 warnings
I'm beginning to not like newton and raknet. Too many compiler errors when there really should be none becouse these are precompiled examples.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

@MikeR: wich lib? stdlib.h is the standard includes from Dev...

As I told you, I'm using Newton and have no probs !!!
I did everything as it's explained in the tutorials, nothing more...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

From dev-dpp?? I'm using vc2003 toolkit with code::blocks.
Ill add that included header and see if that helps.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Oh, I thought you're using Dev, because of the link in your signature... ;)
Well, there must be a similar header file for your environtment...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
latentdisposition
Posts: 29
Joined: Mon Jun 27, 2005 1:17 pm

Post by latentdisposition »

I got it to compile in Code::Blocks with the toolkit by changing all of the dFloats to regular floats. It still had several warnings but it did compile and run perfectly.
"The creation of something new is not accomplished by the intellect but by the play instinct acting from inner necessity. The creative mind plays with the objects it loves."

Carl Jung
Post Reply