GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Aug-2006, 22:26
formail formail is offline
New Member
 
Join Date: Aug 2006
Posts: 2
formail is on a distinguished road

A problem of using opengl in fltk


My compiler is Dev-cpp.i'm using fltk 1.1 7
When I created a new fltk gui project ,i added the next code in it :



CPP / C++ / C Code:
#include <FL/Fl.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
#include<Gl/glut.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.resizable(mygl);
     win.show();
     return(Fl::run());
}

then i compiled it,but not succeeded.the message is :


Code:
[Linker error] undefined reference to `Fl_Gl_Window::~Fl_Gl_Window()' [Linker error] undefined reference to `vtable for Fl_Gl_Window' [Linker error] undefined reference to `Fl_Gl_Window::init()' [Linker error] undefined reference to `Fl_Gl_Window::flush()' [Linker error] undefined reference to `Fl_Gl_Window::show()' [Linker error] undefined reference to `Fl_Gl_Window::hide()' [Linker error] undefined reference to `Fl_Gl_Window::draw_overlay()' [Linker error] undefined reference to `Fl_Gl_Window::resize(int, int, int, int)' [Linker error] undefined reference to `glLoadIdentity@0' ..... [Linker error] undefined reference to `glEnd@0' [Linker error] undefined reference to `Fl_Gl_Window::~Fl_Gl_Window()' ld returned 1 exit status G:\profile\Dev-Cpp\execise\Makefile.win [Build Error] [t4.exe] Error 1






what can i do ?
Thank you!
Last edited by cable_guy_67 : 09-Aug-2006 at 05:29. Reason: Please surround your code with [cpp] ... [/cpp]
  #2  
Old 09-Aug-2006, 12:57
bluekid bluekid is offline
Junior Member
 
Join Date: Apr 2006
Posts: 42
bluekid will become famous soon enough

Re: A problem of using opengl in fltk


link libfltk_gl.a
  #3  
Old 11-Aug-2006, 04:39
formail formail is offline
New Member
 
Join Date: Aug 2006
Posts: 2
formail is on a distinguished road

Re: A problem of using opengl in fltk


Quote:
Originally Posted by bluekid
link libfltk_gl.a

Thank you for your help !It works now.
btw,it also needs to link libopengl32.a &libglu32.a
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenGL in Normal FLTK Windows automatedreason FLTK Forum 2 25-Apr-2008 06:44
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 16:41
FLTK and OpenGL bgarisn FLTK Forum 2 27-Jun-2005 07:22
FLTK with GLUT usmsci FLTK Forum 4 26-Nov-2004 17:21
nVidia & OpenGL Problems in windows XP marjasin Computer Hardware Forum 21 30-Aug-2004 01:57

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:54.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.