Doing a challenge I found on youtube to enhance myskills and had to follow the solution to get it, came across a problem.

I keep getting error code c3867: 'func': function call missing argument list; use '&func' to create a pointer to member

error occured on file "TicTacToeGame.cpp" line 24. it reads "printBoard;"

Three Files

Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
#include "TicTacToeGame.h"


using namespace std;



int main() 
{
	TicTacToeGame game;

	game.playGame();
	
	system("PAUSE"); 
	return 0;
}


TicTacToeGame.cpp
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
#include "TicTacToeGame.h"
#include <iostream>

using namespace std;

//Tic Tac Toe Class Public Varibles.
TicTacToeGame::TicTacToeGame()
{
	clearBoard();
}

void TicTacToeGame::playGame()
{
	char player1 = 'X';
	char player2 = 'Y';

	char currentPlayer = 'X';
	bool isDone = false;

	int x, y;

	while (isDone == false) {

		printBoard;

		x = getXCoord();
		y = getYCoord();

		placeMarker(x, y, currentPlayer);

	}
	
}


//Tic Tac Toe Class Private Variables.
int TicTacToeGame::getXCoord()
{
	int x;
	cout << "Enter the X coordinate: ";
	cin >> x;
	return x;
}
int TicTacToeGame::getYCoord()
{
	int y;
	cout << "Enter the Y coordinate: ";
	cin >> y;
	return y;
}

bool TicTacToeGame::placeMarker(int x, int y, char currentPlayer)
{
	if (board[y][x] != ' ') {
		return false;
	}

	board[y][x] = currentPlayer;
}

void TicTacToeGame::clearBoard()
{
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			board[i][j] = ' ';
		}
	}
}

void TicTacToeGame::printBoard() 
{
	cout << endl;
	cout << " |1 2 3|\n";
	for (int i = 0; i < 3; i++) {
		cout << "--------\n";
		cout << i+1 << "|" << board[i][0] << "|" << board[i][1] << "|" << board[i][2] << "|\n";
	}
	cout << "--------\n";
}


TicTacToeGame.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
class TicTacToeGame
{
public:
	TicTacToeGame();

	void playGame();

private:

	
	int getXCoord();
	int getYCoord();

	bool placeMarker(int x, int y, char currentPlayer);

	// Empties the board
	void clearBoard();
	// Prints the board
	void printBoard();

	char board[3][3]; 
	
};
I don't see where a function called "func" is, but on line 24 of TicTacToeGame.cpp, you have the line printBoard; You need () to actually call the function.
Thank you so much! i knew it had to be such a small little error.
Yep, you're welcome, I've spent 2 hours+ very confuse one time trying to find the bug because I accidentally did int i = index_function(Width * y + x); instead of int i = Width * y + x; or something like that.
Topic archived. No new replies allowed.