Skip to main content
gamedev.net
🔒 Locked

a strange error.

Started by odi Dec 10, 2005 at 6:23 AM 9 replies 850+ views
Original Post
odi
odi
Hi! I get this strange error: error C2143: syntax error : missing ';' before '' when i try to build my project. (VC6) it says the problem is within this code:

#ifndef _Face_
#define _Face_
#include <windows.h>
#include <GL\gl.h>
#include <GL\glu.h>
#include "Basics.h"

class Face : public Pickable
{
public:
	Face(BaseModel* Base);
	virtual int draw(int mode);
	BaseModel *OverallObject;
	vector <int> m_vIndices;
	vector <int> m_nIndices;
	vector <int> m_tIndices;
	int          m_mat;
	int          m_BuildIndex;
};
#endif


can somebody help me solve it? thanx [smile]
dave
dave
If by class head it means the top of the declaration of that class then the problem is probably in the header file that is included last, Basics.h.

Hope that helps,

Dave
Illco
Illco
I'd say the error is rather in Basics.h, in which probably a class declaration is not ended with a semi-colon.

Illco
odi
odi
Thanks...
And one more question please.
Basics.h includes the definition of "Pickable"
and face is supposed to inherit from it but i get the error
"error C2504: 'Pickable' : base class undefined"
how can this be?

GDN001TB
GDN001TB
These may be inclusion errors. Usually when you don't include the header files correctly (perhaps cyclic inclusion) then errors like below may appear:

CInteger myint;//missing ";" before myint

odi
odi
thnx[smile]
and one last question... this time for real.
as you can see in my code , Face has a pointer to a class called "BaseModel".
in order to avoid cyclic inclusion, i added the declaration :

class BaseModel;

before the definition of Face.
but BaseModel is still not recognized...
WHY?

[i used this declaration style several years ago]
Illco
Illco
That should work. What do you mean by not recognized? Please include the specific compiler error. This should work fine:

// Forward class declarationclass BaseModel;// Class definitionclass Face{protected:  BaseModel* baseModel;};


Illco
odi
odi
In the cpp file, when i try to use one of the methods,
i get the error:
error C2027: use of undefined type 'BaseModel' :/
Illco
Illco
The aforementioned use, i.e. using a forward declaration, is ok for the definition of a pointer-member (in a header file) but is not okay for use that requires the type definition. Therefore, in your CPP file, you need to include the header file anyway. So, continuing from my example:
// Header file as before// ...// CPP-file#include "BaseModel.h"Face::SomeMethod( void ){  baseModel->CallMe();}


Illco
Enigma
Enigma
Not the source of your problems, but:

#ifndef _Face_

The identifier _Face_ is reserved for compiler and standard library implementors (identifiers starting with an underscore followed by a capital letter or containing a double underscore are reserved globally and identifiers starting with an underscore are reserved at file scope). Use it at your peril and don't be surprised when it gets tromped on in the future.

Enigma
odi
odi
OK! thanks everybody [smile]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.