Note that there are some explanatory texts on larger screens.

plurals
  1. POLinker errors with private members of class in header file
    text
    copied!<p>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++.</p> <p>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.</p> <p>I'm guessing this is probably a simple fact of c++ I'm not already aware of?</p> <p>Example: I refer to the members of SingleDelay within function definitions of SingleDelay's member classes in a file Delays.cpp. ie:</p> <pre><code>SingleDelay::tick(void *output, void *input, int nbufferFrames)&lt;br&gt;{ //.. code here&lt;br&gt; x = dry * castInput + wet * castInput;&lt;br&gt; } </code></pre> <p>Error 38 error LNK2001: unresolved external symbol "private: static double SingleDelay::dry" (?dry@SingleDelay@@0NA) Delays.obj testall</p> <p>Definition of SingleDelay in Delays.h:</p> <pre><code>class SingleDelay{ private: static double dry; //% of dry signal&lt;br&gt; static double wet; //% of wet signal&lt;br&gt; static unsigned int delay; //Delay in milliseconds&lt;br&gt; static int delayCell; //Index in the delayBuffer of the delay to add&lt;br&gt; static double *delayBuffer; //Delay buffer is 1 second long at sample rate SAMPLE_RATE&lt;br&gt; static unsigned int bufferCell; //Pointer to the current delay buffer cell&lt;br&gt; 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; } }; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload