Having a problem with my overloaded << operator, cygwin is returning 2 errors,
DeckOfCardsDemo.o:DeckOfCardsDemo.cpp:(.text+0xd3): undefined reference to `samuel::operator<<(std::ostream&, samuel::DeckOfCards const&)'
DeckOfCardsDemo.o:DeckOfCardsDemo.cpp:(.text+0xd3): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `samuel::operator<<(std::ostream&, samuel::DeckOfCards const&)'
this is my function in DeckOfCards.cpp
std::ostream& operator << (std::ostream& out, DeckOfCards& card)
{
return out << card.value() << " ";
}
declaration
friend ostream& operator << (ostream& out, const DeckOfCards& card);
and my DeckOfCardsDemo.cpp
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "DeckOfCards.h"
using namespace std;
using namespace samuel;
int main(int argc, char* argv[]) {
if (argc >= 2) {
int seed = atoi(argv[1]);
}
else {
int seed = time(NULL);
srand(seed);
}
DeckOfCards* deck = new DeckOfCards(); //creating a deck
cout << deck->value() << endl; //printing deck
cout << *deck << endl;
return EXIT_SUCCESS;
}