Compilation issue: "vtable for class referenced from:" with no virtual functions

Hello all,

OS, Compiler and add-ons: Lion 10.7, xCode 4.2, ofxMaximillian.

Having a few issues compiling something and I’m non-plussed as to why. Basically, I’m trying to create a visual beat creator that will use circles bouncing off the edges of the screen to trigger samples. You will be able to create the circles at the mouse position with the press of a key, use the mouse movement to set the velocity and finally have the mouse left click to release the circle. Just a description so you can have in your mind what I’m working towards.

So far; I’ve fallen at a pretty early hurdle and its to do with the creation of the class that handles the drawing of my circles. I’ve declared a class that inherits from ofBaseApp, that has a setup, draw and update method. In the draw I have the information about the circles. Now, when I try to compile it gives me this error:

" “vtable for circles”, referenced from:
testApp::testApp()in main.o
testApp::~testApp()in testApp.o
testApp::~testApp()in testApp.o
NOTE: a missing vtable usually means the first non-inline virtual member"

What I don’t understand is that I’m not using any pure virtual functions as far as I can see. It will compile if I remove “class circles” inheritance from ofBaseApp (and this probably where the problem is I think… limited knowledge base diagnostic), but then nothing is drawn to the screen at all.

Please see below my implementation file and my header, thanks in advance for any light shed on the situation.

testApp.h:

  
#pragma once  
  
#include "ofMain.h"  
#include "ofxMaxim.h"  
  
class circles : public ofBaseApp{  
      
      
public:  
      
    void setup();  
    void update();  
    void draw();  
      
      
};  
  
  
class testApp : public ofBaseApp{  
  
	public:  
		~testApp();/* destructor is very useful */  
		void setup();  
		void update();  
		void draw();  
  
		void keyPressed  (int key);  
		void keyReleased(int key);  
		void mouseMoved(int x, int y );  
		void mouseDragged(int x, int y, int button);  
		void mousePressed(int x, int y, int button);  
		void mouseReleased(int x, int y, int button);  
		void windowResized(int w, int h);  
		void dragEvent(ofDragInfo dragInfo);  
		void gotMessage(ofMessage msg);  
	  
		void audioRequested 	(float * input, int bufferSize, int nChannels); /* output method */  
		void audioReceived 	(float * input, int bufferSize, int nChannels); /* input method */  
	  
		int		initialBufferSize; /* buffer size */  
		int		sampleRate;  
		  
		ofTexture myTexture;  
	  
		/* stick you maximilian stuff below */  
	  
		double filtered,sample,outputs[2];  
        float radius;  
      
        maxiFilter filter1;  
		ofxMaxiMix mymix;  
		ofxMaxiOsc sine1;  
		ofxMaxiSample kick,snare,hihat;  
        circles red,green,blue;  
	  
		  
};  
  

The implementation of class circles:

  
//  
//  circles.cpp  
//  beatMaker  
//  
//  Created by Rhys Davies on 05/01/2012.  
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.  
//  
  
#include "testApp.h"  
  
  
void circles::setup(){  
  
  
}  
  
  
void circles::update(){  
  
      
  
}  
  
  
void circles::draw(){  
      
    ofSetColor(255,130,0);  
	float radius = 50 + 10 * sin(1);  
	ofFill();  
	ofCircle(200,700,radius);  
  
  
}  

And finally my testApp.cpp:

  
  
#include "testApp.h"  
  
  
//-------------------------------------------------------------  
testApp::~testApp() {  
	  
	  
}  
  
  
//--------------------------------------------------------------  
void testApp::setup(){  
	/* some standard setup stuff*/  
	  
	ofEnableAlphaBlending();  
	ofSetupScreen();  
	ofBackground(0, 0, 0);  
	ofSetVerticalSync(true);  
    ofSetCircleResolution(50);  
      
  
      
    kick.load("/Users/rhysdavies/Documents/Xcode/of_preRelease_v007_osx/apps/myApps/beatMaker/bin/data/kick.wav");  
    snare.load("/Users/rhysdavies/Documents/Xcode/of_preRelease_v007_osx/apps/myApps/beatMaker/bin/data/snare.wav");  
    hihat.load("/Users/rhysdavies/Documents/Xcode/of_preRelease_v007_osx/apps/myApps/beatMaker/bin/data/hat.wav");  
      
      
	  
	sampleRate 			= 44100;  
	initialBufferSize	= 512;	  
	  
	  
	ofSoundStreamSetup(2,0,this, sampleRate, initialBufferSize, 4);  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
      
      
      
	  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
  
	ofSetColor(255, 255, 255,255);  
    myTexture.draw(0, 0,800,600);  
      
    ofSetColor(255,130,0);  
	float radius = 50 + 10 * sin(1);  
	ofFill();		// draw "filled shapes"  
	ofCircle(100,400,radius);  
      
    green.draw();  
      
      
}  
  
//--------------------------------------------------------------  
void testApp::audioRequested 	(float * output, int bufferSize, int nChannels){  
	  
	  
	for (int i = 0; i < bufferSize; i++){  
  
	}  
	  
}  
  
//--------------------------------------------------------------  
void testApp::audioReceived 	(float * input, int bufferSize, int nChannels){	  
	  
	  
	for (int i = 0; i < bufferSize; i++){  
		  
	}  
	  
}  
  
//--------------------------------------------------------------  
void testApp::keyPressed(int key){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::keyReleased(int key){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
	  
	  
	  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(int x, int y, int button){  
	  
}  
  
//--------------------------------------------------------------  
void testApp::windowResized(int w, int h){  
	  
}  
  
  
  
//--------------------------------------------------------------  
void testApp::gotMessage(ofMessage msg){  
  
}  
  
//--------------------------------------------------------------  
void testApp::dragEvent(ofDragInfo dragInfo){   
  
}  

I realize this isn’t an answer to your question, but out of curiosity, do you really want 2 applications that will run simultaneously? If so, you really should do two separate projects. If you just want something with setup(), update() and draw() methods, just add those methods, but don’t make it extend ofBaseApp.

Thats where you are wrong Joshua, your question answered my question in a round about way. I shouldn’t have extended from ofBaseApp, as that should only happen once per program, like you said. It was actually a problem with where I was drawing the circles. I gave some absolute values and presto presto, everything worked fine.

Now I have a new problem, which I’m going to start a new thread for.