unresolved external symbol

I'm getting the following error:
1>ExampleAIModule.obj : error LNK2001: unresolved external symbol "public: int __thiscall ExampleAIModule::getTop(class BWTA::Polygon)" (?getTop@ExampleAIModule@@QAEHVPolygon@BWTA@@@Z)

for the following method:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
* Method: getTop
* Takes a polygon and returns the lowest y value it touches
*/
int getTop(BWTA::Polygon subject) {
	
	// Note: the lower y values are "higher" on the map
	int top = mapHeight - 1;

	for(BWTA::Polygon::const_iterator i = subject.begin(); 
		i != subject.end(); i++) {
		
		if((*i).y() < top)
			top = (*i).y();
	}
	return top;
}


Any idea on the cause?
Have you defined the Polygon class? Also, what is the ExampleAIModule class? Is this function defined inside it?
The polygon class is part of BWTA, which is imported in ExampleAIModule.h, this method is defined in the ExampleAIModule class.
Another idea: is the code you have above copied from inside the definition of the class ExampleAIModule, or is it in a cpp file?

If it is in a separate cpp file then you need to do this:
int ExampleAIModule::getTop(BWTA::Polygon subject) {
(etc)
since the getTop function is supposed to be a class member, I assume.

Hope this helps :)
That was it! Thanks for the help.
No problem - it's an easy mistake to make. Just be sure you understand why it should be there :)
Topic archived. No new replies allowed.