This is the first time I have done this, I hope I am doing it correctly. If not, guide me toward proper etiquette. I am a beginner, intro C++.

I received a message from the compiler that I don't know how to fix. My question is where is the error?, where do I look to fix it? it is part of the cpp and header file. (I am rotten at this, good at prototypes, rotten at this) any advise is always appreciated.

tictactoe game
//implementation file for class board

#include <iostream>
 using namespace std;

#include "Board.h"

//default constructor
Board::Board()
{
     resetAll();	//call private utility function
}

//function to show board during play
void Board::showBoard(char array[][11], int HORIZONTAL, int VERTICAL)
{
cout << "The Tic Tac Toe Board " << endl << endl;	//for user
	
for (int i =0; i < HORIZONTAL; ++i)  //locate the proper space
     {for (int j = 0; j < VERTICAL; ++j) //saves it in the proper space
     cout << array[i][j] << " ";
     cout << endl << endl; 	  //just for looks
     }
}//end function -showBoard

void Board::resetAll() //private 
{
	//reset to empty game board
	const int HORIZONTAL = 8;
	const int VERTICAL = 11;
	char board[HORIZONTAL][VERTICAL] = {{' ',' ',' ','|',' ',' ',' ','|',' ',' ',' '},		
{' ','.',' ','|',' ','.',' ','|',' ','.',' '},			  {'_','_','_','|','_','_','_','|','_','_','_'},	
{' ',' ',' ','|',' ',' ',' ','|',' ',' ',' '},
{' ','.',' ','|',' ','.',' ','|',' ','.',' '},
{'_','_','_','|','_','_','_','|','_','_','_'},
{' ','.',' ','|',' ','.',' ','|',' ','.',' '},
{' ',' ',' ','|',' ',' ',' ','|',' ',' ',' '}};
}
//interface file for class Board

#ifndef BOARD_H
#define BOARD_H

#include <iostream>
using namespace std;

class Board
{
public:
	//constructors
	Board();
	//mutator functions
	void showBoard(char array[][11], int HORIZONTAL, int VERTICAL);

private:
	void resetAll();
};

#endif

Recommended Answers

All 6 Replies

I know the thread is marked "solved", but you have the only post in it...

What specifically is the error?

Are you calling resetAll() from any location other than the constructor?

No the resetAll() is not called from any location other than the constructor.

>If not, guide me toward proper etiquette.
Code is nice, but if you're getting an error, it's helpful to post that as well.

the error message:

1>------ Build started: Project: Final, Configuration: Debug Win32 ------
1>Linking...
1>LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

1>C:\Documents and Settings\Steve & Dona\My Documents\Visual Studio 2005\Projects\Final\Debug\Final.exe : fatal error LNK1120: 1 unresolved externals

1>Build log was saved at "file://c:\Documents and Settings\Steve & Dona\My Documents\Visual Studio 2005\Projects\Final\Final\Debug\BuildLog.htm"
1>Final - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I have not seen this before.

>unresolved external symbol _main referenced in function ___tmainCRTStartup
Every C++ program needs a main function. The error is saying that ___tmainCRTStartup (the C++ runtime code that runs your program) is trying to reference main in your code, but main doesn't exist.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.