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 10-May-2005, 15:10
asal asal is offline
New Member
 
Join Date: May 2005
Posts: 4
asal is on a distinguished road
Unhappy

loading image


i have recently started using fltk. i like to load an image into my window.however i get this liker error.
[Linker error] undefined reference to `fl_register_images()'
[Linker error] undefined reference to `Fl_JPEG_Image::Fl_JPEG_Image(char const*)'

here is a short version of my program:
CPP / C++ / C Code:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_Box.H>

int main() {
    fl_register_images();                       // initialize image lib
    Fl_Window     win(720,486);                 // make a window
    Fl_Box        box(10,10,720-20,486-20);     // widget that will contain image
    Fl_JPEG_Image jpg("/MyPictures/tango.jpg");      // load jpeg image into ram
    box.image(jpg);                             // attach jpg image to box
    win.show();
    return(Fl::run());
}
Last edited by LuciWiz : 12-May-2005 at 09:23. Reason: Please insert your C++ code between [c++] & [/c++] tags
  #2  
Old 11-May-2005, 07:11
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Quote:
Originally Posted by asal
i have recently started using fltk. i like to load an image into my window.however i get this liker error.
[Linker error] undefined reference to `fl_register_images()'
[Linker error] undefined reference to `Fl_JPEG_Image::Fl_JPEG_Image(char const*)'

Hello and welcome asal. You just need one more switch to compile this:

Code:
g++ -Wall simple_image.cpp `fltk-config --ldflags --cxxflags --use-images` -s -o TestMain

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #3  
Old 11-May-2005, 08:14
asal asal is offline
New Member
 
Join Date: May 2005
Posts: 4
asal is on a distinguished road
thanks for your help. is there any way to add these in dev c++ instead of using cygwin?
  #4  
Old 11-May-2005, 08:31
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Quote:
Originally Posted by asal
thanks for your help. is there any way to add these in dev c++ instead of using cygwin?

Hmmm, do you run fltk-config from dev-c++ somewhere with the --ld and --cxx flags (perhaps in the makefile) ? That would be the place to add it. If not, you will have to manually add the image libs to your linker in dev to take care of the problem.

Look at the --help stuff for fltk-config. What I usually do is something like this to find what I need from fltk-config.

Code:
Me@mycpu~ $ fltk-config --ldflags --cxxflags -I/usr/local/include -I/usr/local/include/FL/images -mwindows -DWIN32 -L/usr/local/lib -mwindows -lfltk -lpthread -lole32 -luuid -lcomctl32 -lwsock32 -lsupc++ Me@mycpu~ $ fltk-config --use-images --ldflags --cxxflags -I/usr/local/include -I/usr/local/include/FL/images -mwindows -DWIN32 -L/usr/local/lib -mwindows -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg -lfltk -lpthread -lole32 -luuid -lcomctl32 -lwsock32 -lsupc++

As you can see it shows what should be linked and you can use that info to add the libs to dev-c++. As you see from my example the libs change when adding the --use-images flag.

Hope this helps,

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #5  
Old 11-May-2005, 08:51
asal asal is offline
New Member
 
Join Date: May 2005
Posts: 4
asal is on a distinguished road
i added the libs manually and my project works. thank you so much.
  #6  
Old 24-Feb-2006, 12:43
lolo83120 lolo83120 is offline
New Member
 
Join Date: Feb 2006
Posts: 1
lolo83120 is on a distinguished road

Re: loading image


Hi, I just start to program in C++. I also use dev C++ and fltk, and I would like to know how did u add the the libs manually and which libs, cause i d'on't know how to do it and my project doesn't work.
Thanks for ur answer.
 
 

Recent GIDBlogToyota - 2008 November Promotion by Nihal

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
how to do basic image processing using MFC yuhui MS Visual C++ / MFC Forum 5 08-Aug-2006 06:43
Checking source codes of image, audio and video files onauc C Programming Language 5 26-Feb-2005 22:47
Writing image to folder misunderstood MySQL / PHP Forum 4 17-Jun-2004 08:18
Google Adsense introduces targetted image ads Div Advertising & Affiliates Forum 5 23-May-2004 11:59
professional quality image generator jrobbio Graphics Forum 0 27-May-2003 05:45

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

All times are GMT -6. The time now is 07:50.


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