Weird syntax errors for iGameObject

Started by
8 comments, last by Ziron999 15 years, 11 months ago
typedef uint msgRet;

interface iGameObject
{
public:
	virtual objID GetID() = 0;
	virtual void SetID( objID id ) = 0;

	virtual msgRet ProcMsg( const sMsg& msg ) = 0;
};
it looks ok but????
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(267) : error C2146: syntax error : missing ';' before identifier 'iGameObject'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(267) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(267) : error C2470: 'iGameObject' : looks like a function definition, but there is no parameter list; skipping apparent body
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(289) : error C2065: 'iGameObject' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(289) : error C2059: syntax error : '>'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(298) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(301) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(303) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(305) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(307) : error C2065: 'iGameObject' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(307) : error C2065: 'pObj' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(307) : error C2143: syntax error : missing ',' before ')'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(311) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(313) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(321) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(326) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(328) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(331) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(333) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(337) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(339) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(342) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(344) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(349) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(351) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(354) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(356) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(361) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(363) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(366) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(368) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(375) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(377) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(382) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(384) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(28) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(37) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(39) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(46) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(47) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(59) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(61) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(63) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(65) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(68) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(70) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(73) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(75) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(81) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(99) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(103) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(106) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(110) : error C2065: 'cNetMessageMaker' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(110) : error C2059: syntax error : '>'
c:\tddownload\source\book code\game\gamecommon\netmsgs\netmessages.h(113) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(25) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(33) : error C2065: 'sEntState' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(34) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(41) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(55) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(63) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(70) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(84) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(92) : error C2065: 'sEntState' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(93) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(100) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(112) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(118) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(125) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(138) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(146) : error C2065: 'sEntState' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(147) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(154) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(167) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(172) : error C2065: 'm_pitch' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(178) : error C2065: 'sEntState' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(178) : error C2065: 'state' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(178) : error C2143: syntax error : missing ',' before ')'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(179) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(186) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(198) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(203) : error C2065: 'm_pitch' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(209) : error C2065: 'sEntState' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(209) : error C2065: 'state' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(209) : error C2143: syntax error : missing ',' before ')'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(210) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(217) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(228) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(230) : error C2065: 'm_pitch' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(236) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.h(243) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(14) : error C2653: 'cNM_EntAdd' : is not a class or namespace name
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(16) : error C2065: 'sEntState' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(18) : error C2065: 'state' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(18) : error C3861: 'm_state': identifier not found
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(19) : error C2143: syntax error : missing ',' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(19) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(20) : error C2143: syntax error : missing ';' before '}'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(22) : error C2653: 'cNM_EntAdd' : is not a class or namespace name
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(23) : error C2143: syntax error : missing ';' before '{'
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(26) : error C2065: 'm_entID' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(26) : error C2065: 'dataSize' : undeclared identifier
c:\tddownload\source\book code\game\gamecommon\netmsgs\entnm.cpp(26) : fatal error C1003: error count exceeds 100; stopping compilation
Advertisement
Looks like you are compiling in C++, try replacing interface with class.
Also, if a class has virtual functions, it should also have a virtual destructor (even if it does nothing). More.
ok that did fix a lot of my issues but now my conversion is messed up this isnt good :D

//==========--------------------------  Conversion functionsinline msgRet FloatToMRet( const float& in ){	return *((msgRet*)(&in));}inline float MRetToFloat( const msgRet& in ){	return *((float*)(&in));}inline msgRet PointToMRet( const point3& in ){	return (msgRet)(&in);}inline point3 MRetToPoint( const msgRet& in ){	return *((point3*)in);}inline msgRet MatrixToMRet( const matrix4& in ){	return (msgRet)(&in);}inline matrix4 MRetToMatrix( const msgRet& in ){	return *((matrix4*)in);}inline msgRet BSphereToMRet( const bSphere3& in ){	return (msgRet)(&in);}inline bSphere3 MRetToBSphere( const msgRet& in ){	return *((bSphere3*)in);}


EDIT:
oops sry heres errors, pretty much the same.....

:\tddownload\source\book code\game\gamecommon\msgdaemon.h(347) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(347) : error C2143: syntax error : missing ',' before '&'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(349) : error C2065: 'in' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(352) : error C2146: syntax error : missing ';' before identifier 'MRetToMatrix'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(352) : error C2433: 'matrix4' : 'inline' not permitted on data declarationsc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(352) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(353) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(354) : error C2059: syntax error : ')'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(355) : warning C4508: 'MRetToMatrix' : function should return a value; 'void' return type assumedc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2065: 'cNetMessage' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2065: 'nMsg' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(53) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2146: syntax error : missing ')' before identifier 'player'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2182: 'ReliableSendToPlayer' : illegal use of type 'void'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2078: too many initializersc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(53) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(399) : error C2059: syntax error : ')'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2065: 'cNetMessage' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2065: 'nMsg' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(53) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2146: syntax error : missing ')' before identifier 'player'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2182: 'UnreliableSendToPlayer' : illegal use of type 'void'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2078: too many initializersc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(53) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(400) : error C2059: syntax error : ')'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(402) : error C2065: 'cNetMessage' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(402) : error C2065: 'nMsg' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(402) : error C2182: 'UnreliableBroadcast' : illegal use of type 'void'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(402) : fatal error C1903: unable to recover from previous error(s); stopping compilation
What's on line 347? Let's start there.
347: inline msgRet MatrixToMRet( const matrix4& in )
348: {
349: return (msgRet)(&in);
340: }
seems it doesn't know what uint is. Try UINT, or DWORD. There maybe an include needed for it, but I forget what it is.

Do you have Visual Assist? I highly recommend it, the syntax highlighting will show you what is not defined.
whoa i cant aford that..... anyway it goes back to my orginal problem

--------------------------->typedef uint msgRet;

class iGameObject
{
public:
virtual ~iGameObject() { }
virtual objID GetID() = 0;
virtual void SetID( objID id ) = 0;

virtual msgRet ProcMsg( const sMsg& msg ) = 0;
};

which just so happens to be right above what i changed......and yes the correct file is included which has.....

typedef unsigned char uChar;
typedef unsigned short uShort;
typedef unsigned long uLong;
typedef unsigned int uInt;

typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned long ulong;
typedef unsigned int uint;
It's actually complaining about matrix4, not uint. Make sure matrix4 is forward declared.

Additionally, try to avoid C-style casts whereever possible. Here your ugly C-style *((type*)&thing) cast can be replaced with a simple reinterpret_cast< const type & >(thing).

Σnigma
void ReliableSendToPlayer( cNetMessage& nMsg, objID player );void UnreliableSendToPlayer( cNetMessage& nMsg, objID player );void UnreliableBroadcast( cNetMessage& nMsg );void ReliableBroadcast( cNetMessage& nMsg );void ReliableBroadcastExcept( cNetMessage& nMsg, objID exception );


c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2065: 'cNetMessage' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2065: 'nMsg' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(54) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2146: syntax error : missing ')' before identifier 'player'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2182: 'ReliableSendToPlayer' : illegal use of type 'void'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2078: too many initializersc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(54) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(403) : error C2059: syntax error : ')'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2065: 'cNetMessage' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2065: 'nMsg' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(54) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2146: syntax error : missing ')' before identifier 'player'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2182: 'UnreliableSendToPlayer' : illegal use of type 'void'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2078: too many initializersc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2275: 'objID' : illegal use of this type as an expression        c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(54) : see declaration of 'objID'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(404) : error C2059: syntax error : ')'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(406) : error C2065: 'cNetMessage' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(406) : error C2065: 'nMsg' : undeclared identifierc:\tddownload\source\book code\game\gamecommon\msgdaemon.h(406) : error C2182: 'UnreliableBroadcast' : illegal use of type 'void'c:\tddownload\source\book code\game\gamecommon\msgdaemon.h(406) : fatal error C1903: unable to recover from previous error(s); stopping compilation


if i comment out everything that has to do with this my error comes back to iGameObject for some reason its not identifying correctly now.

This topic is closed to new replies.

Advertisement