Find the answer to your Linux question:
Results 1 to 5 of 5
I've just recently started GTK Programming in Linux and the one problem I have come across so far is that if I wanted to insert an image in my program: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    2

    gtk_image_new_from_file problem


    I've just recently started GTK Programming in Linux and the one problem I have come across so far is that if I wanted to insert an image in my program:
    GtkWidget *image;
    image = gtk_image_new_from_file("logo.jpg");

    I would always get the following compile error:
    undefined reference to `gtk_image_new_from_file'

    What am I doing wrong?

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    I don't know GTK, but it sounds like you're missing a header file in your source file (assuming this error is at the compile stage).

  3. #3
    Just Joined!
    Join Date
    May 2005
    Posts
    2
    I've looked at a few examples that use GtkImage, but they only include the <gtk/gtk.h> header file. Which I have already included in my source

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    May 2005
    Posts
    2
    i have exactly the same problem....whatever i try i get the same message...
    Come on people try to help us pleeease

  6. #5
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575
    Don't be such a crybaby , we're trying :P

    You probably need to link it with the right library.It is similar to the problem
    in this thread.
    I don't know what the library name is in this case.A quick Google search gave
    some option --libs gtk+-2.0
    If that doesn't work just keep googling for gtk_image_new_from_file until you
    find some link which mentions the correct option.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •