External error searching 2-d arrays

Here is a simple program I wrote to search a 2-D array, unfortunately when running this:

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
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;

char list[][5] = {"the","big","shot"};
int searchList(char [][5], int, char []);

int main()
{ 

 

	char title[20];
	int result = 0;
        cout << "Please int the title you wish to search for\n";
	cin.getline(title,20);
	result = searchList(list, 3, title);
	cout << result << endl;
	return 0;
}


int serachList(char titL[][5], int size, char value[])
{
	int index = 0;
	int position = -1;
	bool found = false;

	while (index < size && !found)
	{
		if (strcmp(titL[index],value) == 0)
		{
			found = true;
			position = index;
		}
		index++;
	}
	return position;
}


I get the following errors:

error LNK2019: unresolved external symbol "int __cdecl searchList(char (* const)[5],int,char * const)" (?searchList@@YAHQAY04DHQAD@Z) referenced in function _main
fatal error LNK1120: 1 unresolved externals
2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Any help would be appreciated as it seems as though I've tried everything.
This error message is very clear. The linker could not find the definition of int searchList(char (* const)[5],int,char * const)

So you shall define this function if you use it in the main.

You made a typo in its definition serachList
Last edited on
A stupid spelling error aghh! Anyway thanks for making me realize it.
Topic archived. No new replies allowed.