LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-12-2013, 07:01 AM   #1
invoices
LQ Newbie
 
Registered: Jun 2013
Posts: 2

Rep: Reputation: Disabled
fltk error


Hello,
I'm having troubles using FLTK.

I found following code snapshot in some fltk tutorial:

Code:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
using namespace std;

//--------------------------------------------
void but_cb( Fl_Widget* o, void*  ) {
   Fl_Button* b=(Fl_Button*)o;
   b->label("Good job"); //redraw not necessary
 
   b->resize(10,150,140,30); //redraw needed
   b->redraw();
}

//-------------------------------------------- 
int main() {

    Fl_Window win( 300,200,"Testing" );
    win.begin();
       Fl_Button but( 10, 150, 70, 30, "Click me" );
    win.end();
    but.callback( but_cb );
    win.show();
    return Fl::run();
}
If I try to run this we eclipse, I'm getting following error:

Code:
11:58:45 **** Incremental Build of configuration Debug for project fltk ****
make all 
Building target: fltk
Invoking: Cross G++ Linker
g++  -o "fltk"  ./src/fltk.o   
../src/fltk.cpp:9: error: undefined reference to 'Fl_Widget::label(char const*)'
../src/fltk.cpp:12: error: undefined reference to 'Fl_Widget::redraw()'
../src/fltk.cpp:18: error: undefined reference to 'Fl_Window::Fl_Window(int, int, char const*)'
../src/fltk.cpp:19: error: undefined reference to 'Fl_Group::begin()'
../src/fltk.cpp:20: error: undefined reference to 'Fl_Button::Fl_Button(int, int, int, int, char const*)'
../src/fltk.cpp:21: error: undefined reference to 'Fl_Group::end()'
../src/fltk.cpp:23: error: undefined reference to 'Fl_Window::show()'
../src/fltk.cpp:24: error: undefined reference to 'Fl::run()'
../src/fltk.cpp:24: error: undefined reference to 'Fl_Window::~Fl_Window()'
../src/fltk.cpp:24: error: undefined reference to 'Fl_Window::~Fl_Window()'
/usr/local/include/FL/Fl_Button.H:75: error: undefined reference to 'vtable for Fl_Button'
/usr/local/include/FL/Fl_Button.H:75: error: undefined reference to 'Fl_Widget::~Fl_Widget()'
collect2: ld gab 1 als Ende-Status zurück
make: *** [fltk] Fehler 1

11:58:45 Build Finished (took 115ms)
I'm facing the same problem in a different project that uses fltk with qtcreator. I'm using Ubuntu 12.04 64bit running on a i5 notebook (acer 4820tg).

Thank you
 
Old 06-13-2013, 04:29 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
Welcome to LQ.

The above example is for fltk version 1.1.6
Ref. http://www3.telus.net/public/robark/

If you have installed "libfltk1.1-dev" + "fltk1.1-doc" :
The 1.1.10 examples are in /usr/share/doc/fltk1.1-doc/examples/

And if you have installed "libfltk1.3-dev" + "fltk1.3-doc" :
/usr/share/doc/fltk1.3-doc/examples/

Ref. http://www.fltk.org/documentation.php/doc-1.1/toc.html
>>> http://www.fltk.org/documentation.ph....html#examples

-
 
Old 06-13-2013, 06:29 AM   #3
invoices
LQ Newbie
 
Registered: Jun 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you for your reply.

I have installed following libraries: fltk1.1-doc libfltk1.1 libfltk1.1-dbg libfltk1.1-dev.
Unfortunately, I'm not able to run this example. Can you tell me the right steps to get it compiled ?

Thank you
 
Old 06-13-2013, 06:57 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
# 3 .
Quote:
I'm not able to run this example
Which example ?

If it's about the example in post #1 : Is for "old fltk" only : 1.1.6.
Please read http://www3.telus.net/public/robark/ : Year 2005.

FLTK versions are not compatible. Hence two versions in Ubuntu.

Some other Linux OS also have fltk-2.0.0 included :
I.e. we have three contemporary version, not compatible with each other.
And then we have the old versions.

-
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Is FLTK 2.X Compatible With FLTK 1.X? Zssfssz Programming 3 04-24-2012 04:28 AM
Ubuntu FLTK Installation error abhijeet664 Linux - Newbie 2 05-08-2011 02:08 PM
FLTK Makefile Noxious020189 Programming 1 12-05-2008 07:43 AM
FLTK 2.0 SVN r6191 Compile Error nickbird Programming 2 09-07-2008 05:25 AM
fltk question amos Programming 0 10-10-2003 12:19 PM


All times are GMT -5. The time now is 07:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration