Hello,
This is my first time working with OF, and I’m attempting to follow the HelloWorld example on this pdf:
http://www.doc.gold.ac.uk/~ma501ed/Open%20Frameworks.pdf
I’ve followed the example, but when I build my project I get this "undefined reference to vtable error:
||Warning: .drectve `-defaultlib:LIBCMT ' unrecognized|
||Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized|
||Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
obj\Release\src\main.o:main.cpp:(.text.startup+0x82)||undefined reference to `vtable for HelloWorldApp'|
obj\Release\src\main.o:main.cpp:(.text.startup+0x89)||undefined reference to `vtable for HelloWorldApp'|
||=== Build finished: 2 errors, 17 warnings (0 minutes, 1 seconds) ===|
Any thoughts on what this could be?
Much thanks!
This is my code:
//HelloWorldApp.h//
#ifndef _HELLO_WORLD
#define _HELLO_WORLD
#include "ofMain.h" //include oF's ofMain class, linked here
class HelloWorldApp : public ofBaseApp{
public:
void setup();//we need this to load the font
void draw();//we need this to draw the font to the screen
ofTrueTypeFont franklin;//the font we will load
};
#endif // HELLOWORLDAPP_H_INCLUDED
//HelloWorldApp.cpp//
#include "HelloWorldApp.h"
void HelloWorldApp::setup()
{
//load out font and give it a name
franklin.loadFont("frabk.ttf",32);
ofBackground(255,255,255);
}
void HelloWorldApp::draw()
{
ofSetColor(0,0,0);
franklin.drawString("Hello World!",100,380);//experiment
}
//main.cpp//
#include "ofMain.h"
#include "HelloWorldApp.h"
//========================================================================
int main( ){
//ofAppGlutWindow window:
ofSetupOpenGL(300,368, OF_WINDOW); //experiment with sizes
// <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new HelloWorldApp());
}
I honestly default to using the project generator for new apps since it handles all the setup. Have you tried running any of the examples and gotten the same error?
I’ve run some examples, and I don’t get any error.
I tried using the project generator, and it works now 
thanks for the tip!
1 Like