Gary Weissman schrieb:
> Here is the new error output from the linker:
> 
> fltk::GlWindow::init()
> vtable for GraphEngine
> vtable for fltk::GlWindow
> collect2: ld returned 1 exit status
> make: *** [sampleFLTK] Error 1


can reproduce "undefined reference to `vtable for GraphEngine'"
on Linux (2.6.18) with fltk-2.0.x-r5990


$ fltk2-config --use-gl --compile test.cxx
gcc -I/home/flips/src/fltk2 -I/usr/include/freetype2
-Wno-non-virtual-dtor -o vtable_inheritance vtable_inheritance.cxx
-L/home/flips/src/fltk2/lib /home/flips/src/fltk2/lib/libfltk2_gl.a
-lGLU -lGL /home/flips/src/fltk2/lib/libfltk2.a -lX11 -lXi -lXinerama
-lXft -lpthread -lm -lXext -lsupc++
/tmp/ccwgRwIz.o: In function `GraphEngine::GraphEngine(int, int, int,
int, char const*)':
test.cxx:(.text._ZN11GraphEngineC1EiiiiPKc[GraphEngine::GraphEngine(int,
int, int, int, char const*)]+0x35): undefined reference to `vtable for
GraphEngine'
collect2: ld returned 1 exit status

commenting the destructor works !!!!


-- some working code below:
// fltk2-config --use-gl --compile test.cxx
#include "fltk/Window.h"
#include <fltk/run.h>
#include <fltk/gl.h>
#include <fltk/GlWindow.h>

using namespace fltk;

class GraphEngine : public fltk::GlWindow
        {
public :
        GraphEngine(int X,int Y,int W,int H,const char*L=0)
                : fltk::GlWindow(X,Y,W,H,L)
                {}
        //~GraphEngine();
private:
        void 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();
                }
        };

int main(int argc, char **argv)
        {
        Window *window = new Window(700, 500, "Window Sample");
        window->begin();
        GraphEngine *engine = new GraphEngine (10, 150, 500, 350, 0);
        window->end();
        window->show();
        return fltk::run();
        }

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to