I have tried to google this error and have not found anything useful. Im pretty new at programming so please bear with me. This error showed when I first compiled card.cpp and has not gone away since then. All of my cpp files for this program are giving the same error. When I compile I keep getting this when I type in g++ card.cpp (or any of my .cpp files)-
/tmp/ccW6ByXY.s: Assembler messages:
/tmp/ccW6ByXY.s:13: Error: symbol `_ZNSi6ignoreE' is already defined
/tmp/ccW6ByXY.s:25: Error: symbol `_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreE' is already defined
I have my driver and 3 .h
files (with their respective .cpp files). When I compile each one separately or together they each give this message. Any information is appreciated.
#include "card.h"
//using namespace std;
Card::Card()
{
rank = 'A';
suit = spades;
}
Card::Card(int _rank, Suit _suit)
{
rank = _rank;
suit = _suit;
}
string Card::toString() const //return string of card (ie 2h)
{
string cardString = suitString() + rankString();
return cardString;
}
int Card::getRank() const
{
return rank;
}
Card::Suit Card::getSuit() const
{
return suit;
}
bool Card::operator == (const Card &rhs) const
{
return (rank==rhs.rank) || (suit == rhs.suit);
}
string Card::suitString() const
{
Suit s = spades;
switch(s)
{
case spades: return "s";
break;
case hearts: return "h";
break;
case diamonds: return "d";
break;
case clubs: return "c";
break;
}
}
card.h is below
#ifndef _CARD_H
#define _CARD_H
#include <iostream>
#include <string>
using namespace std;
class Card
{
public:
enum Suit {spades, hearts, diamonds, clubs};
Card(); // default: ace of spades
Card(int, Suit);
string toString() const; // return string version: Ac 4h Js
int getRank() const; // return rank, 1..13
Suit getSuit() const; // return suit
bool operator == (const Card &rhs) const;
private:
int rank;
Suit suit;
string suitString() const; // return "s", "h",...
string rankString() const; // return "A", "2", ..."Q"
};
#endif