I can't identify the problem can somebody help me?

objects.h (abstract base)

#ifndef objects_h
#define objects_h

#include "colorScreen.h"
#include "maincontrol.h"
#include <ctime> #include <string>
using namespace std;

class objects
{
public:
	virtual ~objects();
	virtual void print(const MainControl &inMain)const =0; 
protected:
	objects();
	objects(const int& inX, const int& inY,const int&inScore);
...

13.(missing type specifier - int assumed. )


food.h (derived)

#ifndef food_h
#define food_h

#include <iostream>
#include "objects.h"

using namespace std;

class food: public objects 
{
public:
	food(const int&inX, const int&inY, const int&inScore); 
	virtual ~food();
	virtual void print(const MainControl &inMain)const;
...

9. ('objects' : base class undefined)
14. (missing type specifier - int assumed. )

maincontrol.h

#ifndef maincontrol_h
#define maincontrol_h

#include <iostream> #include <fstream> #include <string> #include <vector>
#include "food.h"
#include "colorScreen.h"
using namespace std;

class objects;

class MainControl
{
public:
	MainControl(...);
	void print(const MainControl &in) const;
	friend objects; 
...

I frd MainControl with objects here

can anyone identify the problem? Thanks!

The code you posted isn't very useful. Check for missing semicolons, especially at the end of the class declaration

class object
{
<snip>
};

Looks like the problem may be in the way you have the header files included.

food.h >> objects.h >> maincontrol.h >> food.h

So nothing is fully defined. Try adding class forward references.

i have }; for all three classes
what else could have caused the problem?

I added some more to my previous post -- please re-read it for more suggestions

thx!!!!
I have an extra include of "food.h"

another problem

i want to frd the MainControl with the derived class food too

class objects;
class food;
class MainControl
{
public:
friend objects;
friend food;
...
};

MainControl::MainControl(char x)
{
switch(x)
{
case 'f': pointer = new food(...);break;
...
}
}

15. error C2514: 'food' : class has no constructors

is the error caused by my way of friending MainControl with a derived class?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.