> can reproduce "undefined reference to `vtable for GraphEngine'"
> on Linux (2.6.18) with fltk-2.0.x-r5990
OK - I'd assumed it was an OSX specific probloem, but it's not... Just
tried it on this winXP/mingw box, and yup, fails...
> commenting the destructor works !!!!
Indeed it does... So... There is something about destructors and such...
Anybody? I used to know this stuff...
Here's my build output: This builds and runs OK -
$ make clean ; make
Compile main.o...
gcc -c -o main.o main.cpp -Wall -O2 -I/usr/local/include -mwindows
-DWIN32 -Wno-non-virtual-dtor
main.cpp: In function `int main(int, char**)':
main.cpp:16: warning: unused variable 'engine'
Compile GraphEngine.o...
gcc -c -o GraphEngine.o GraphEngine.cpp -Wall -O2 -I/usr/local/include
-mwindows -DWIN32 -Wno-non-virtual-dtor
gcc -o gwtest.exe main.o GraphEngine.o -L/usr/local/lib
/usr/local/lib/libfltk2_gl.a -lglu32 -lopengl32
/usr/local/lib/libfltk2.a -mwindows -lmsimg32 -lole32 -luuid -lcomctl32
-lwsock32 -lsupc++ -lm
And here's my cut of the code:
// filename: main.cpp
// contains main function
#include <cstdlib>
#include "fltk/Window.h"
#include <fltk/Widget.h>
#include <fltk/run.h>
#include "GraphEngine.hpp"
using namespace fltk;
int main(int argc, char **argv) {
Window *window = new Window(700, 500, "Window Sample");
window->begin();
GraphEngine *engine = new GraphEngine (10, 10, 500, 350);
window->end();
window->show();
return fltk::run();
}
/* end of file */
===================================
// filename: GraphEngine.hpp
#ifndef _HAVE_GRAPH_ENGINE_HDR_
#define _HAVE_GRAPH_ENGINE_HDR_ 1
#include <fltk/gl.h>
#include <fltk/GlWindow.h>
#include <fltk/Window.h>
class GraphEngine : public fltk::GlWindow{
public :
GraphEngine(int X,int Y,int W,int H,const char*L=0);
// ~GraphEngine();
private:
void draw();
};
#endif // _HAVE_GRAPH_ENGINE_HDR_
===================================
// filename: GraphEngine.cpp
#include "GraphEngine.hpp"
GraphEngine::GraphEngine(int X,int Y,int W,int H,const char*L) :
fltk::GlWindow(X,Y,W,H,L){}
void GraphEngine::draw() { // Clear screen
glClear(GL_COLOR_BUFFER_BIT); // Draw white 'X'
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINE_STRIP);
glVertex2f(w(), h());
glVertex2f(-w(),-h());
glEnd();
}
===================================
SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk