I get the following error message when I try to invoke Game::play() member function, I've been searching for what could be the error. But I couldn't find it.
Here's Game.h
#pragma once
#include <iostream>
class Game {
public:
void selectPlayer();
// Player* nextPlayer() const;
bool isRunning() const;
void play();
void announceWinner();
};
Game.cpp implementation
#include "Game.h"
void Game::selectPlayer() {
}
bool Game::isRunning() const {
}
void Game::play() {
// while (isRunning()) {
// board.display();
// }
//board.display();
std::cout << "hello\n";
}
void Game::announceWinner() {
std::cout << "Game is over\n";
}
main.cpp
#include <iostream>
#include "Game.h"
int main() {
Game g;
g.play();
}
I get this error when I invoke play(): undefined reference to
Game::play()'`