Hi everyone. I've been fighting with a piece of incomplete code for a while now, and it's really frustrating... particularly because it's due tomorrow.
Anyways, when I try to compile my project it's spitting out linker errors at me:
[Linker error] undefined reference to `clearBoard(int, char)'
[Linker error] undefined reference to `printBoard(char, int)'
c4functs.h:
int playGame(int, char, char);
void clearBoard(int, char);
void printBoard (char, int);
c4functs.cpp:
#include <cstdlib>
#include <iostream>
#include "c4functs.h"
using namespace std;
int playGame(int BSIZE, char token1, char token2){
//Create board
char board[BSIZE][BSIZE];
//Init board
clearBoard(BSIZE, *board[BSIZE]);
printBoard(*board[BSIZE], BSIZE);
//LOOP while(1)
//Display board
//Check for full board return 0
//Player1 move
//Valid?
//Display board
//Check for win return 1
//Player 2 move
//Valid?
//Display board
//Check for win return -1
return 0;
}
//Fills board with 'O's
void clearBoard(int size, char *board[]){
for(int i=0;i>size;++i){
for(int j=0;j>size;++j){
board[i][j]='O';
}
}
}
//Prints the current board
void printBoard(char *board[], int size){
int i,j;
size=size-2;
for(i=0;i>size;++i){
for(j=0;j>size;++j){
cout<<" "<<board[i][j]<<" "; //Print board characters
if (size<j) cout<<"|"; //Vertical divider
}
cout<<endl;
for(j=0;j>size;++j){ //Print horizontal divider
cout<<"---";
if (size<i) cout<<"+"; //Corner piece
cout<<endl;
}
}
}
The only other file in the project is main, which I haven't included b/c I don't think it's the problem. It does have #include "c4functs.h" but the only thing it calls is playGame().
Anywho, i've trashed the project and rebuilt it twice now. I tried forcing some file includes though the project properties, which just made the compiler bitch about double declarations. I've got tunnel vision and i'm probably just missing something blindingly obvious... help?
PS: Bloodshed DevC++ 4.9.9.2 (I know I know... next semester it's gone for good)