link error

my code is as follows
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//creates a 10 by 10 word search puzzle
//words determined by a specified filed
//word locations then specified by user
//program creates random letters to fill in the puzzle
//programmer : Tyler Sievers
#include <iostream>
#include <fstream>
#include <string>
using namespace std;


const int k=5;    // 5 is the most words allowed in file. constant for the first array
const int r=10;		//10 rows high
const int c=10;		//10 collomns wide

void getfile(ifstream&);
void populatearray(ifstream&, string[]);
void testfcn1(string[]);  //comment when done!!!!	
void displaygrid(char[][c]);
void colomncounter();
void horizontalborders();
void fillgrid(char[][c]);
void printgrid(const char[][c]);

void main(){
	//more or less does nothing :]
	ifstream infile;
	string words[k];
	char thegrid[r][c];    //tron reference intended... if only i were as good a programmer...
	cout<<"welcome to the Word Finder Generator\n\n";
	getfile(infile);
	populatearray(infile, words);
	//testfcn1(words);   // COMMENT WHEN DONE!!!
	system("CLS");
	fillgrid(thegrid);
	displaygrid(thegrid);
	return;
}

void getfile(ifstream& words){
	//gets the file name from the user, opens it, and returns to the main
	string filename;
	do{
	cout<<"Please enter the name of the file with the word list: ";
	cin >> filename;
	words.open(filename.c_str());
	if (words.fail())
		cout << "I'm sorry, that file could not be found. Please try again.\n";
	}while(words.fail());
	return;
}
void populatearray(ifstream& infile, string word[])
{//takes the array words and fills it with the words from the file!!
	int i; //array counter
	for(i=0; i<k; i++){
		infile>>word[i];}
	return;
}
void testfcn1(string word[]){
	//test module to be sure my fill module works correctly 
	//        COMMENT THIS OUT WHEN DONE!!!!
	int i;
	for(i=0;i<k;i++){
		cout<<word[i];
		cout<<endl;}
	return;
}
void displaygrid(const char thegrid[][c]){
	//manages all the sub modules that display and change the grid
	colomncounter();
	horizontalborders();
	printgrid(thegrid);
	horizontalborders();
	colomncounter();
}
void horizontalborders(){
		int i=0;
	cout<<"  ";
	for(i=0; i<c; i++){
		cout<<"---";
	}
	cout<<endl;
	}
void colomncounter(){
	int i=0;
	cout<<"   ";
	for(i=0; i<c; i++){
		cout<<i<<"  ";
	}
	cout<<endl;
}
void fillgrid(char thegrid[][c]){
	//fills the grid with .'s
	int i, j; //counters
	for(i=0;i<r;i++)
		for(j=0;j<c;j++)
		thegrid[i][j]='.';
}
void printgrid(char thegrid[][c]){
	int i,j; //counters... i'm sick of this comment
	for(i=0;i<r;i++){
		cout<<i<<"|";
		for(j=0;j<c;j++){
			cout<<" "<<thegrid[i][j]<<" ";}
		cout<<"|"<<i<<endl;}
}


i am getting 3 errors

Error 1 error LNK2019: unresolved external symbol "void __cdecl displaygrid(char (* const)[10])" (?displaygrid@@YAXQAY09D@Z) referenced in function _main c:\Users\Tyler\documents\visual studio 2010\Projects\program 1b-3\program 1b-3\prog_1b-3.obj program 1b-3

Error 2 error LNK2019: unresolved external symbol "void __cdecl printgrid(char const (* const)[10])" (?printgrid@@YAXQAY09$$CBD@Z) referenced in function "void __cdecl displaygrid(char const (* const)[10])" (?displaygrid@@YAXQAY09$$CBD@Z) c:\Users\Tyler\documents\visual studio 2010\Projects\program 1b-3\program 1b-3\prog_1b-3.obj program 1b-3

Error 3 error LNK1120: 2 unresolved externals c:\users\tyler\documents\visual studio 2010\Projects\program 1b-3\Debug\program 1b-3.exe program 1b-3

last night when i called it quits none of these errors came up and i can't see what could be causing them any ideas?
Your printgrid() and displaygrid() function prototypes are swapped. One takes a const char[][], and the other takes a normal char[][]. The prototypes have it the opposite way.
I thought i had fixed that last night before i went to sleep... well crap... you have been an incredible help zhuge thanks a lot man
Topic archived. No new replies allowed.