Whats wrong with Match !!??
Nov 9, 2012 at 9:39am UTC
here is my header file of Match.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#ifndef __MATCH_H_
#define __MATCH_H_
#ifndef __STD_INCLUDE_
#define __STD_INCLUDE_
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#endif
#include"league_heder.h"
#include"team_heder.h"
using namespace std;
class Match {
public :
Match(string, string);
void add_host_goal(string);
void add_guest_goal(string);
string get_host_name();
private :
};
#endif
and this is another header of mine:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#ifndef __LEAGUE_H_
#define __LEAGUE_H_
#ifndef __STD_INCLUDE_
#define __STD_INCLUDE_
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#endif
#include"team_heder.h"
#include"match_heder.h"
using namespace std;
class League {
public :
League(vector<string>);
void add_match(Match);
void print_champion();
void print_top_scorer();
private :
vector<Team> teams;
};
#endif
which have error on this way:
error C2061: syntax error : identifier 'Match'
(in the add_match function..)
i think it's obvious mistake .. but i cant detect that!!
please help me !!
Last edited on Nov 9, 2012 at 9:40am UTC
Nov 9, 2012 at 10:00am UTC
You included "league_heder.h" before "match_heder.h" in "match_heder.h". So class League is defined before class Match. In this case inside class League name Match was not yet declared.
Topic archived. No new replies allowed.