# Error C2259: cannot instantiate abstract class

**URL:** <https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457>\
**Category:** General JUCE discussion\
**Created:** [February 26, 2014, 6:15pm UTC](https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457 "2014-02-26T18:15:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mihnea](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mihnea](https://forum.juce.com/u/mihnea)\
**Post date:** [February 26, 2014, 6:15pm UTC](https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457/1 "2014-02-26T18:15:41Z")

</div>

Hi everybody!

I am new to C++ and Juce but I need to use it for a Uni module. I have searched for similar errors/issues by other users but couldn't find an answer that may be able to fix my problem.

Long story short: I am trying to build a simple compressor but I get the forementioned error: 2259: cannot instantiate abstract class.

I am trying to build it with Visual Studio 2012 which points at the bolded lines, does anyone have any ideas as to what is causing the error?

I apologize if it sounds like a noob question but I really like Juce and would like to experiment with it but can't get past this...

&nbsp;

Best,

M.

&nbsp;

> // This creates new instances of the plugin..  
> **AudioProcessor\* JUCE\_CALLTYPE createPluginFilter()  
> {  
> &nbsp; &nbsp; return new CompressorAudioProcessor();  
> }**
> 
> int CompressorAudioProcessor::round(float inn)  
> {  
> &nbsp;&nbsp; &nbsp;if (inn \> 0) return (int) (inn + 0.5);  
> &nbsp;&nbsp; &nbsp;else return (int) (inn - 0.5);  
> }  
> const String CompressorAudioProcessor::getName() const  
> {  
> &nbsp; &nbsp; return JucePlugin\_Name;  
> }  
> int CompressorAudioProcessor::getNumParameters()  
> {  
> &nbsp; &nbsp; return 0;  
> }  
> float CompressorAudioProcessor::getParameter (int index)  
> {  
> &nbsp; &nbsp; return 0.0f;  
> }  
> void CompressorAudioProcessor::setParameter (int index, float newValue)  
> {  
> }  
> const String CompressorAudioProcessor::getParameterName (int index)  
> {  
> &nbsp; &nbsp; return String::empty;  
> }  
> const String CompressorAudioProcessor::getParameterText (int index)  
> {  
> &nbsp; &nbsp; return String::empty;  
> }  
> const String CompressorAudioProcessor::getInputChannelName (int channelIndex) const  
> {  
> &nbsp; &nbsp; return String (channelIndex + 1);  
> }  
> const String CompressorAudioProcessor::getOutputChannelName (int channelIndex) const  
> {  
> &nbsp; &nbsp; return String (channelIndex + 1);  
> }  
> bool CompressorAudioProcessor::isInputChannelStereoPair (int index) const  
> {  
> &nbsp; &nbsp; return true;  
> }  
> bool CompressorAudioProcessor::isOutputChannelStereoPair (int index) const  
> {  
> &nbsp; &nbsp; return true;  
> }  
> bool CompressorAudioProcessor::acceptsMidi() const  
> {  
> #if JucePlugin\_WantsMidiInput  
> &nbsp; &nbsp; return true;  
> #else  
> &nbsp; &nbsp; return false;  
> #endif  
> }  
> bool CompressorAudioProcessor::producesMidi() const  
> {  
> #if JucePlugin\_ProducesMidiOutput  
> &nbsp; &nbsp; return true;  
> #else  
> &nbsp; &nbsp; return false;  
> #endif  
> }  
> int CompressorAudioProcessor::getNumPrograms()  
> {  
> &nbsp; &nbsp; return 0;  
> }  
> int CompressorAudioProcessor::getCurrentProgram()  
> {  
> &nbsp; &nbsp; return 0;  
> }  
> void CompressorAudioProcessor::setCurrentProgram (int index)  
> {  
> }  
> const String CompressorAudioProcessor::getProgramName (int index)  
> {  
> &nbsp; &nbsp; return String::empty;  
> }  
> void CompressorAudioProcessor::changeProgramName (int index, const String& newName)  
> {  
> }  
> &nbsp;

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [February 26, 2014, 6:18pm UTC](https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457/2 "2014-02-26T18:18:23Z")

</div>

Well, this error&nbsp;is a basic C++ one: you ain't filling out the pure-virtual&nbsp;methods from the base class (or&nbsp;classes). Any struct/class method marked with "= 0" at the end is stating that it is pure-virtual.

Your error should state which one(s). (Though MSVC errors are so damned ugly and take some getting used to&nbsp;- it may not be obvious.)

---

<div class="post-metadata">

**Author:** ![mihnea](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mihnea](https://forum.juce.com/u/mihnea)\
**Post date:** [February 26, 2014, 6:33pm UTC](https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457/3 "2014-02-26T18:33:31Z")

</div>

I realize it might be an obvious one but I cannot figure it out. Here's the full error:

> 1\>..\..\Source\PluginProcessor.cpp(172): error C2259: 'CompressorAudioProcessor' : cannot instantiate abstract class  
> 1\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;due to following members:  
> 1\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'bool juce::AudioProcessor::silenceInProducesSilenceOut(void) const' : is abstract  
> 1\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\res\juce\modules\juce\_audio\_processors\processors/juce\_AudioProcessor.h(249) : see declaration of 'juce::AudioProcessor::silenceInProducesSilenceOut'  
> 1\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'double juce::AudioProcessor::getTailLengthSeconds(void) const' : is abstract  
> 1\> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\res\juce\modules\juce\_audio\_processors\processors/juce\_AudioProcessor.h(252) : see declaration of 'juce::AudioProcessor::getTailLengthSeconds'

Any thoughts?

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [February 26, 2014, 6:58pm UTC](https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457/4 "2014-02-26T18:58:27Z")

</div>

So, let me reword&nbsp;the error message,&nbsp;because the same error happens multiple times:

> The class is still abstract, you need to fill out the following methods as they are missing:
> 
> - "bool juce::AudioProcessor::silenceInProducesSilenceOut(void) const"
> 
> - "double juce::AudioProcessor::getTailLengthSeconds(void) const"

Hopefully this will help get you going!

---

<div class="post-metadata">

**Author:** ![mihnea](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mihnea](https://forum.juce.com/u/mihnea)\
**Post date:** [February 27, 2014, 6:54pm UTC](https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457/5 "2014-02-27T18:54:37Z")

</div>

Still no luck but I get the following error now:

![](https://dl.dropboxusercontent.com/u/1757767/Screenshot%202014-02-27%2018.49.15.png)

Thoughts?

---

<div class="post-metadata">

**Author:** ![oxxyyd](https://avatars.discourse-cdn.com/v4/letter/o/e47c2d/32.png) [@oxxyyd](https://forum.juce.com/u/oxxyyd)\
**Post date:** [February 27, 2014, 7:12pm UTC](https://forum.juce.com/t/error-c2259-cannot-instantiate-abstract-class/12457/6 "2014-02-27T19:12:50Z")

</div>

http://stackoverflow.com/questions/1306778/c-virtual-pure-virtual-explained
