I have a program that should place a number of fish randomly in a "bay", this code compiled fine on the school computers, but i cant get it to compile at home...
#include "fish.h"
ostream& operator << (ostream & out, fish& fish1)
{
out << " the type is " << fish1.type << endl;
out << " the direction is" << fish1.dir << endl;
return out;
}
A.cpp
1 2 3 4 5 6 7 8 9 10
#include "fish.h"
int main()
{
fish f1;
cout << f1 << endl;
fish f2('F',3);
cout << f2 << endl;
return 0;
}
B.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13
#include "bay.h"
int main()
{
bay bay1;
int numFish;
cout << " Enter the num of the fish" << endl;
cin >> numFish;
bay1.placeFish(numFish);
cout << bay1;
return 0;
}
when i compile i get this:
Omar-MacBook-Pro:fish Omar$ g++ A.cpp B.cpp bay.cpp fish.cpp -o fish
ld: duplicate symbol _main in /var/folders/gq/3yhytq9n0bn85ztg7h1fg5b80000gn/T//cc668x73.o and /var/folders/gq/3yhytq9n0bn85ztg7h1fg5b80000gn/T//cc65E7qb.o for architecture x86_64
collect2: ld returned 1 exit status
Omar-MacBook-Pro:fish Omar$