Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Unable to install gtk2

  1. #1
    Join Date
    Apr 2015
    Location
    Indiana
    Posts
    87

    Default Unable to install gtk2

    I am learning to program in C and I need to have gtk2 installed in order to access the gtk library. When I run the command sudo zypper search gtk the output shows that the gtk2-tools is installed. I am currently running OpenSUSE 15.1 with a KDE desktop environment. Thank you in advance for your assistance.
    Bryan Sailer
    SpaceMonkey
    openSUSE LEAP 15.1
    KDE
    "Don't sweat the small stuff, it's all small stuff"

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,110
    Blog Entries
    15

    Default Re: Unable to install gtk2

    Quote Originally Posted by bryansailer View Post
    I am learning to program in C and I need to have gtk2 installed in order to access the gtk library. When I run the command sudo zypper search gtk the output shows that the gtk2-tools is installed. I am currently running OpenSUSE 15.1 with a KDE desktop environment. Thank you in advance for your assistance.
    Hi
    If you use a wildcard for searching, plus if programming, then your after the development package, gtk2-devel to be installed.

    Code:
    zypper se gtk*devel
    You should not need to use sudo for searches and also only develop as your user, become root to install
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3
    Join Date
    Apr 2015
    Location
    Indiana
    Posts
    87

    Default Re: Unable to install gtk2

    malcolmlewis,
    Thank you for your assistance. That is what I was looking for to fix my problem. I also appreciate your guidance on the use of sudo.
    Bryan Sailer
    SpaceMonkey
    openSUSE LEAP 15.1
    KDE
    "Don't sweat the small stuff, it's all small stuff"

  4. #4
    Join Date
    Apr 2015
    Location
    Indiana
    Posts
    87

    Default Re: Unable to install gtk2

    Now that I have the gtk library installed I am having trouble compiling my code. In OpenSUSE the gtk.h file is located at /usr/include/gtk-2.0/gtk/gtk.h. I have added this location to my code but I an still getting the following error.

    In file included from chapter14.c:1:0:
    /usr/include/gtk-2.0/gtk/gtk.h:32:21: fatal error: gdk/gdk.h: No such file or directory
    compilation terminated.

    How do I fix this issue?
    Bryan Sailer
    SpaceMonkey
    openSUSE LEAP 15.1
    KDE
    "Don't sweat the small stuff, it's all small stuff"

  5. #5
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,110
    Blog Entries
    15

    Default Re: Unable to install gtk2

    Quote Originally Posted by bryansailer View Post
    Now that I have the gtk library installed I am having trouble compiling my code. In OpenSUSE the gtk.h file is located at /usr/include/gtk-2.0/gtk/gtk.h. I have added this location to my code but I an still getting the following error.

    In file included from chapter14.c:1:0:
    /usr/include/gtk-2.0/gtk/gtk.h:32:21: fatal error: gdk/gdk.h: No such file or directory
    compilation terminated.

    How do I fix this issue?
    Hi
    In your code you should just have the following?

    Code:
    #include <gtk-2.0/gtk/gtk.h>
    #include <gtk-2.0/gtk/gdk.h>
    Both headers and in the gtk directory, can you confirm?
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  6. #6
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,761

    Default Re: Unable to install gtk2

    Check permissions.

  7. #7
    Join Date
    Apr 2015
    Location
    Indiana
    Posts
    87

    Default Re: Unable to install gtk2

    malcolmlewis,
    The headers are in different directories. Under the gtk-2.0 directory there is a gdk directory and a gtk directory. Each header is located in the respective directory.

    What should the permissions be for each file?
    Bryan Sailer
    SpaceMonkey
    openSUSE LEAP 15.1
    KDE
    "Don't sweat the small stuff, it's all small stuff"

  8. #8
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,110
    Blog Entries
    15

    Default Re: Unable to install gtk2

    Quote Originally Posted by bryansailer View Post
    malcolmlewis,
    The headers are in different directories. Under the gtk-2.0 directory there is a gdk directory and a gtk directory. Each header is located in the respective directory.

    What should the permissions be for each file?
    Hi
    So what does your code look like?

    Normally the makefile should automatically add the /usr/include, so it would be;

    Code:
    #include <gtk-2.0/gtk/gtk.h>
    #include <gtk-2.0/gdk/gdk.h>
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  9. #9
    Join Date
    Apr 2015
    Location
    Indiana
    Posts
    87

    Default Re: Unable to install gtk2

    I am following a a guide from Raspberry Pi, C GUI Programming. I do not have a make file. The guide explains that I should be able to compile my code. My code is shown below.

    Code:
    #include <gtk-2.0/gtk/gtk.h>
    #include <gtk-2.0/gdk/gdk.h>
    
    int main (int argc, char *argv[])
    {
            gtk_init (&argc, &argv);
            GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
            gtk_widget_show (win);
            gtk_main();
            return 0;
    }
    Bryan Sailer
    SpaceMonkey
    openSUSE LEAP 15.1
    KDE
    "Don't sweat the small stuff, it's all small stuff"

  10. #10
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,110
    Blog Entries
    15

    Default Re: Unable to install gtk2

    Quote Originally Posted by bryansailer View Post
    I am following a a guide from Raspberry Pi, C GUI Programming. I do not have a make file. The guide explains that I should be able to compile my code. My code is shown below.

    Code:
    #include <gtk-2.0/gtk/gtk.h>
    #include <gtk-2.0/gdk/gdk.h>
    
    int main (int argc, char *argv[])
    {
            gtk_init (&argc, &argv);
            GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
            gtk_widget_show (win);
            gtk_main();
            return 0;
    }
    Hi
    If you run;
    Code:
    pkg-config --cflags --libs gtk+-2.0
    I suspect the gtk-2.0 is already in the include directory, so remove that from the #include line

    Code:
    #include <gtk/gtk.h>
    #include <gdk/gdk.h>
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

Page 1 of 2 12 LastLast

Posting Permissions

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