I'm using Visual Studio 2005 and don't know how to solve this problem. Till now, everything worked just fine, included all the necessary libs, headers and so on.
But there is the problem:
I have to implement a class ColorSpaces with static member functions, which manipulates a buffer from the class MSImage and returns it.
ColorSpaces.h looks like this:
Expand|Select|Wrap|Line Numbers
- class ColorSpaces
- {
- public:
- ColorSpaces();
- virtual ~ColorSpaces(void);
- // returns a buffer, where the L,a,b values of a given MSImage are stored
- static char* calculateLab(MSImage* image);
- static char* calculateLuv(MSImage* image);
- static char* calculateRG(MSImage* image);
- };
Expand|Select|Wrap|Line Numbers
- ColorSpaces::ColorSpaces()
- {
- }
- // ----------------------------------------------------------------------------
- ColorSpaces::~ColorSpaces(void)
- {
- }
- char* ColorSpaces::calculateLab(MSImage* image)
- {
- // cout << image->data3D << endl;
- }
- char* ColorSpaces::calculateLuv(MSImage* image)
- {
- }
- char* ColorSpaces::calculateRG(MSImage* image)
- {
- }
Expand|Select|Wrap|Line Numbers
- MSImage msimage(str,false); // reads image and safes it in unsigned char*** data3D
- ColorSpaces::calculateLab(&msimage);
Problem 1:
Why I get this error message?
Expand|Select|Wrap|Line Numbers
- error LNK2001: unresolved external symbol "public: static char * __cdecl ColorSpaces::calculateLab(class MSImage *)" (?calculateLab@ColorSpaces@@SAPADPAVMSImage@@@Z)
When I'm hoovering over calculateLab with my mouse, tooltip says:
Expand|Select|Wrap|Line Numbers
- int* ColorSpaces::calculateLab(void);
msdn says the following:
Only global functions and variables are placed in the OBJ PST table. Trying to access variables of the types below will often cause Unresolved Externals.But there is no solution to this problem, because my function has to be static.
Static functions/variables
Functions declared with the static modifier by definition have file scope. Static variables have the same limitation. Trying to access any static variables from outside of the file in which they are declared can result in a compile error or an unresolved external depending on the specific coding of the source files.
Can anybody help me pleeze? Would be much appreciated. Thx
Bye
Adamn