Hello,
I am running Ubuntu using the GCC compiler. I have installed the dev files for
Mesa and tried to compile the example (OpenGL Simple Example) from Erco's FLTK
cheat page:
#include <FL/Fl.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
//
// Simple resizable 2D GL window
// erco 10/08/05
//
class MyGlWindow : public Fl_Gl_Window {
// DRAW METHOD
// OpenGL window: (w,h) is upper right, (-w,-h) is lower left, (0,0)
is center
//
void draw() {
// First time? init viewport, etc.
if (!valid()) {
valid(1);
glLoadIdentity();
glViewport(0,0,w(),h());
glOrtho(-w(),w(),-h(),h(),-1,1);
}
// 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();
glBegin(GL_LINE_STRIP); glVertex2f(w(),-h()); glVertex2f(-w(), h());
glEnd();
}
// HANDLE WINDOW RESIZING
// If window reshaped, need to readjust viewport/ortho
//
void resize(int X,int Y,int W,int H) {
Fl_Gl_Window::resize(X,Y,W,H);
glLoadIdentity();
glViewport(0,0,W,H);
glOrtho(-W,W,-H,H,-1,1);
redraw();
}
public:
// CONSTRUCTOR
MyGlWindow(int X,int Y,int W,int H,const char*L=0) :
Fl_Gl_Window(X,Y,W,H,L) {
}
};
// MAIN
int main() {
Fl_Window win(500, 300);
MyGlWindow mygl(10, 10, win.w()-20, win.h()-20);
win.end();
win.resizable(mygl);
win.show();
return(Fl::run());
}
Using the command:
fltk-config --compile one.cxx
The error message I get makes no sense to me (as follows):
g++ -I/usr/include/freetype2 -o one one.cxx -lfltk
/tmp/cc1ZGyBf.o: In function `MyGlWindow::resize(int, int, int, int)':
one.cxx:(.text._ZN10MyGlWindow6resizeEiiii[MyGlWindow::resize(int, int, int,
int)]+0x29): undefined reference to `Fl_Gl_Window::resize(int, int, int, int)'
one.cxx:(.text._ZN10MyGlWindow6resizeEiiii[MyGlWindow::resize(int, int, int,
int)]+0x2e): undefined reference to `glLoadIdentity'
one.cxx:(.text._ZN10MyGlWindow6resizeEiiii[MyGlWindow::resize(int, int, int,
int)]+0x50): undefined reference to `glViewport'
one.cxx:(.text._ZN10MyGlWindow6resizeEiiii[MyGlWindow::resize(int, int, int,
int)]+0x98): undefined reference to `glOrtho'
/tmp/cc1ZGyBf.o: In function `MyGlWindow::draw()':
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x33): undefined
reference to `glLoadIdentity'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x67): undefined
reference to `glViewport'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0xed): undefined
reference to `glOrtho'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0xf9): undefined
reference to `glClear'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x118): undefined
reference to `glColor3f'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x124): undefined
reference to `glBegin'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x15c): undefined
reference to `glVertex2f'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x198): undefined
reference to `glVertex2f'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x19d): undefined
reference to `glEnd'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x1a9): undefined
reference to `glBegin'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x1e3): undefined
reference to `glVertex2f'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x21d): undefined
reference to `glVertex2f'
one.cxx:(.text._ZN10MyGlWindow4drawEv[MyGlWindow::draw()]+0x222): undefined
reference to `glEnd'
/tmp/cc1ZGyBf.o: In function `MyGlWindow::~MyGlWindow()':
one.cxx:(.text._ZN10MyGlWindowD0Ev[MyGlWindow::~MyGlWindow()]+0x17): undefined
reference to `Fl_Gl_Window::~Fl_Gl_Window()'
/tmp/cc1ZGyBf.o: In function `MyGlWindow::~MyGlWindow()':
one.cxx:(.text._ZN10MyGlWindowD1Ev[MyGlWindow::~MyGlWindow()]+0x17): undefined
reference to `Fl_Gl_Window::~Fl_Gl_Window()'
/tmp/cc1ZGyBf.o: In function `Fl_Gl_Window::Fl_Gl_Window(int, int, int, int,
char const*)':
one.cxx:(.text._ZN12Fl_Gl_WindowC2EiiiiPKc[Fl_Gl_Window::Fl_Gl_Window(int, int,
int, int, char const*)]+0x36): undefined reference to `vtable for Fl_Gl_Window'
one.cxx:(.text._ZN12Fl_Gl_WindowC2EiiiiPKc[Fl_Gl_Window::Fl_Gl_Window(int, int,
int, int, char const*)]+0x46): undefined reference to `Fl_Gl_Window::init()'
/tmp/cc1ZGyBf.o:(.rodata._ZTV10MyGlWindow[vtable for MyGlWindow]+0x1c):
undefined reference to `Fl_Gl_Window::flush()'
/tmp/cc1ZGyBf.o:(.rodata._ZTV10MyGlWindow[vtable for MyGlWindow]+0x20):
undefined reference to `Fl_Gl_Window::show()'
/tmp/cc1ZGyBf.o:(.rodata._ZTV10MyGlWindow[vtable for MyGlWindow]+0x24):
undefined reference to `Fl_Gl_Window::hide()'
/tmp/cc1ZGyBf.o:(.rodata._ZTV10MyGlWindow[vtable for MyGlWindow]+0x28):
undefined reference to `Fl_Gl_Window::draw_overlay()'
/tmp/cc1ZGyBf.o:(.rodata._ZTI10MyGlWindow[typeinfo for MyGlWindow]+0x8):
undefined reference to `typeinfo for Fl_Gl_Window'
collect2: ld returned 1 exit status
I do not know where to go from here. Any help would be appreciated.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk