Hi. I'm trying to build a project in Visual Studio 2008. I'm getting a bunch of linker errors that are really bothering me. My application is a Win32 console application using only native ANSI C++.
They are all linker errors of the same pattern. Linker errors are related to every single private static data member of classes I have defined in my own header files.
I'm guessing this is probably a simple fact of c++ I'm not already aware of?
Example: I refer to the members of SingleDelay within function definitions of SingleDelay's member classes in a file Delays.cpp. ie:
SingleDelay::tick(void *output, void *input, int nbufferFrames)
{
//.. code here
x = dry * castInput + wet * castInput;
}
Error 38 error LNK2001: unresolved external symbol "private: static double SingleDelay::dry" (?dry@SingleDelay@@0NA) Delays.obj testall
Definition of SingleDelay in Delays.h:
class SingleDelay{
private:
static double dry; //% of dry signal<br>
static double wet; //% of wet signal<br>
static unsigned int delay; //Delay in milliseconds<br>
static int delayCell; //Index in the delayBuffer of the delay to add<br>
static double *delayBuffer; //Delay buffer is 1 second long at sample rate SAMPLE_RATE<br>
static unsigned int bufferCell; //Pointer to the current delay buffer cell<br>
public:
//Tick function
static void tick(void *output, void *input,int nBufferFrames);
//Set and Get functions
static void setSingleDelay(double tDry, double tWet, unsigned int tDelay);
static void setSingleDelay(void);
static void setDry(double tDry);
static void setWet(double tWet);
static void setDelay(unsigned int tDelay);
static double getDry(){ return dry;}
static double getWet(){ return wet;}
static unsigned int getDelay(){ return delay;}
static void initializeDelayBuffer(){
destroyDelayBuffer();
delayBuffer = new double[bufferLength];
}
static void destroyDelayBuffer(){
delete[ ] delayBuffer;
}
};