i get error when i compile..
here is my code
Code:
/*this is my header file for my file called C.h*/
#ifndef _C_H_
#define _C_H_
#include "I.h"
using namespace std;
class C {
public:
void get_foo(int, int);
void set_bar(int,I*);
void monkey(int, I*);
void cow(I*);
private:
I * stinky;
};
#endif
Code:
/*This is my header file for my file called I.h*/
#ifndef _I_H_
#define _I_H_
#include "C.h"
using namespace std;
class I{
public:
void get_monkey(int, C *);
private:
C * hello;
};
#endif
Now when i compile my program i get errors relating to all the lines that contain the type of other header file.
so in the I.h i get errors on all the lines that have the type C.
and in the C.h i get errors on all the lines that have the type I.
Code:
In file included from I.h:3,
from I.cpp:2:
C.h:31: error: type specifier omitted for parameter `Item'
C.h:31: error: syntax error before `*' token
C.h:33: error: type specifier omitted for parameter `Item'
C.h:33: error: syntax error before `*' token
C.h:34: error: `Item' was not declared in this scope
C.h:34: error: syntax error before `)' token
C.h:49: error: syntax error before `*' token
make: *** [I.o] Error 1
/*ignore the line numbers because i have removed all the irrelevant functions for this example*/
but here line 31 is referring to
void set_bar(int,I*);
from the C.h file.