Guys,
Why do we have these unresolved externals? This is the second time I am meeting them, and I'm sure it is a common problem. I've defined all the constructors including a void constructor just for the sake of (I don't actually need it). Pray tell where the error is:

Error 9 error LNK2028: unresolved token (0A00036D) "public: struct dataStructure<unsigned char> * __thiscall myImageClass::getData(void)" (?getData@myImageClass@@$$FQAEPAU?$dataStructure@E@@XZ) referenced in function "int __cdecl main(int,char * * const)" (?main@@$$HYAHHQAPAD@Z) new.obj

Error 10 error LNK2019: unresolved external symbol "public: struct dataStructure<unsigned char> * __thiscall myImageClass::getData(void)" (?getData@myImageClass@@$$FQAEPAU?$dataStructure@E@@XZ) referenced in function "int __cdecl main(int,char * * const)" (?main@@$$HYAHHQAPAD@Z) new.obj

In main()

////////////////////////////////////////////////////////////////////////////////////
dataStructure<uchar> *data;

myImageClass *i = new myImageClass("c:\\tit\\lena.bmp");	
data=i->getData();

In myImageClass.h
class myImageClass {
public:
	//Constructors
	myImageClass();
	myImageClass(char *fileNameP); // initialize by loading data from image file
	myImageClass(dataStructure<uchar> *dat); // From data structure
	~myImageClass();

////////////////////////////////////////////////////////////////////////////////////
These are well defined in myImageClass.cpp
////////////////////////////////////////////////////////////////////////////////////

myImageClass::myImageClass(){
	setFileName(defaultFileName);
	initialize();
}
 myImageClass::myImageClass(char *fileNameP){
	if (setFileName(fileNameP))
		initialize();	
	else {
		classData=0; filename=0;
	}
}
 myImageClass::myImageClass(dataStructure<uchar> *dat){
	 if (dat){
		 classData->data=0;
		 classData = (dataStructure<uchar> *) dat;
		 filename=defaultFileName;
	 }
}

////////////////////////////////////////////////////////////////////////////////////

Recommended Answers

All 2 Replies

Where is getData() defined (or declared for that matter). There may be a mismatch somewhere.

Why do we have these unresolved externals?

Would you rather your program run without the appropriate functions? ;)

Thanks j.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.