Page 1 of 2

New_Irr example...compile errors

Posted: Thu Sep 15, 2005 1:07 am
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.

Posted: Thu Sep 15, 2005 2:04 am
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????)

Posted: Thu Sep 15, 2005 2:12 am
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();

Posted: Thu Sep 15, 2005 11:33 am
by dhenton9000
I wonder if the compiler somehow handles static keyword differently.

Posted: Thu Sep 15, 2005 11:28 pm
by MikeR
I don't know. It should work the same.
Which lib file did you link to?

Posted: Fri Sep 16, 2005 12:04 am
by FlyHigh
The error means it probably didn't have a declaration for dFloat. You tried forward declareing it and including all nessecary files?

Posted: Fri Sep 16, 2005 3:03 am
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.

Posted: Fri Sep 16, 2005 10:02 am
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.

Posted: Fri Sep 16, 2005 2:18 pm
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....

Posted: Sat Sep 17, 2005 12:53 am
by MikeR
I don't find that lib anywhere. Where did you find it?

Posted: Sun Sep 18, 2005 4:47 pm
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.

Posted: Sun Sep 18, 2005 9:13 pm
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...

Posted: Mon Sep 19, 2005 3:06 am
by MikeR
From dev-dpp?? I'm using vc2003 toolkit with code::blocks.
Ill add that included header and see if that helps.

Posted: Mon Sep 19, 2005 1:12 pm
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...

Posted: Mon Sep 19, 2005 1:59 pm
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.