who can help me? :(
Nov 13, 2012 at 6:39pm UTC
i have these header files:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
#ifndef __LEAGUE_H_
#define __LEAGUE_H_
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#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_of_league;
};
#endif
#ifndef __TEAM_H_
#define __TEAM_H_
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
using namespace std;
class Team {
public :
Team(string tm_nm);
void add_scorer(string);
string get_name();
vector<string> get_scorer();
string get_scr_nm(int );
void add_score(int );
int get_score();
private :
string team_name;
int score;
vector<string> scorer;
};
#endif
#ifndef __MATCH_H_
#define __MATCH_H_
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#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();
string get_guest_name();
string get_guest_src_nm(int i);
string get_host_src_nm(int i);
vector<string> get_host_scorer();
vector<string> get_guest_scorer();
private :
Team guest_team;
Team host_team;
};
#endif
____________________________________________________________________________________
and their cpp ..
and this main:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#include "match_heder.h"
#include "league_heder.h"
#include "team_heder.h"
int main()
{
int t, n_team;
for (cin >> t; t != 0; t--){
vector<string> teams;
string team_name;
for (cin >> n_team; n_team != 0; n_team--) {
cin >> team_name;
teams.push_back(team_name);
}
League league(teams);
while (true ) {
string host, guest;
cin >> host >> guest;
if (host == "-" && guest == "-" )
break ;
Match match(host, guest);
int host_score, guest_score;
cin >> host_score >> guest_score;
string scorer;
for (int i = 0; i < host_score; i++) {
cin >> scorer;
match.add_host_goal(scorer);
}
for (int i = 0; i < guest_score; i++) {
cin >> scorer;
match.add_guest_goal(scorer);
}
league.add_match(match);
}
league.print_champion();
league.print_top_scorer();
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
after compiling, i got these errors :
ProfHadis-MacBook-Pro:~ hadi$ g++ team_heder.h
ProfHadis-MacBook-Pro:~ hadi$ g++ match_heder.h
ProfHadis-MacBook-Pro:~ hadi$ g++ league_heder.h
ProfHadis-MacBook-Pro:~ hadi$ g++ team_cpipi.cpp
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
ProfHadis-MacBook-Pro:~ hadi$ g++ team_cpipi.cpp
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
WHAT SHOULD I DO ???
Topic archived. No new replies allowed.