So im newbie and im doing a school project (got really strict rules about datatypes) need to use arrays instead of vectors. and stuff like that. So im basicaly storing every gamemap type as 10x10 array and showing only size depending on userconfig file.
template <class myType>
void printBoard(myType board[10][10], int size) {
for (int j = 0; j < size; j++) {
cout << endl;
if (j == 0) {
cout << " ";
for (int jj = 1; jj <= size; jj++)
cout << jj << " ";
cout << endl;
}
switch (j)
{
case 0: cout << "A "; break;
case 1: cout << "B "; break;
case 2: cout << "C "; break;
case 3: cout << "D "; break;
case 4: cout << "E "; break;
case 5: cout << "F "; break;
case 6: cout << "G "; break;
case 7: cout << "H "; break;
case 8: cout << "I "; break;
case 9: cout << "J "; break;
default:
break;
}
for (int i = 0; i < size; i++) {
cout << board[i][j] << " ";
}
}
cout << endl;
return;
}`
Thats my function for printing arrays of different size and type. It works well! But when i try to move function to new cpp file. i get unresolved external symbol error
Im not really sure how i should construct my header file. Ive tried different methods without success.
HEADER:
#pragma once
template <typename myType>
void printBoard(myType board[10][10],int size);
I think i need to read some more about this subject? Any help here?