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

Thread: almost there - need help setting up gtk dev

  1. #1
    Join Date
    Sep 2009
    Location
    UK
    Beans
    435
    Distro
    Ubuntu 10.04 Lucid Lynx

    almost there - need help setting up gtk dev

    Summary
    I want to know how to get gtk+ c++ (gtkmm) and Anjuta working...

    I get this error when compiling gtk (c++ gtkmm) in anjuta
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:60: error: ‘GtkVBox’ does not name a type

    Full Details
    I have years of programing experience and would love to get developing some new apps for linux, however i can't seem to get gtk interface working.

    (I'm a noob to developing in linux)

    So far i have created a wxwidgets c++ test program with a connection to a postgre sql database, works great.
    (I had to add a few config options to code::blocks to get this working).

    Now I wish to take full advantage of gtk libaries, to do this I was attempting to use gtkmm with code::blocks. This threw many errors and I have added many options to the compiler which resolved some issues but not all. I read in another thread that anjuta was great for making things a little easyer setting up.

    So I am now using ajuntu which looks and feels great but i still can't compile gtk.
    when compiling gtk in ajuntu;

    • i get no messages of missing dependancies (i did when i 1st got it).
    • I do get 10 errors

    The 10 Errors are as follows;

    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:60: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:68: error: ‘GtkVBoxClass’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:46: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:53: error: ‘GtkVBoxClass’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:69: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:94: error: ‘GtkVBoxClass’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkgamma.h:63: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkgamma.h:76: error: ‘GtkVBoxClass’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:48: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:55: error: ‘GtkVBoxClass’ does not name a type

    anyone know if i need to add config options or install somthing else?

    thanks

    --------------------------------

    update:

    I think i may need to include somthing before htkmm.h?

    my code is:

    #include <libglademm/xml.h>
    #include <gtkmm.h>
    #include <iostream>

    #ifdef ENABLE_NLS
    # include <libintl.h>
    #endif


    /* For testing propose use the local (not installed) glade file */
    /* #define GLADE_FILE PACKAGE_DATA_DIR"/gtk_foobar/glade/gtk_foobar.glade" */
    #define GLADE_FILE "src/gtk_foobar.glade"

    int
    main (int argc, char *argv[])
    {
    Gtk::Main kit(argc, argv);

    //Load the Glade file and instiate its widgets:
    Glib::RefPtr<Gnome::Glade::Xml> refXml;
    try
    {
    refXml = Gnome::Glade::Xml::create(GLADE_FILE);
    }
    catch(const Gnome::Glade::XmlError& ex)
    {
    std::cerr << ex.what() << std::endl;
    return 1;
    }
    Gtk::Window* main_win = 0;
    refXml->get_widget("main_window", main_win);
    if (main_win)
    {
    kit.run(*main_win);
    }
    return 0;
    }

    update:


    please anyone?
    Last edited by mikejonesey; October 24th, 2009 at 04:36 PM.

  2. #2
    Join Date
    Mar 2008
    Location
    Italy, Milan
    Beans
    234
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: almost there - need help setting up gtk dev

    Hi Mike,
    same as you I started with the idea of Gtkmm (as I like C++) and Anjuta but then, being learning python too thanks to some nautilus python extensions I had to write, I started to appreciate PyGTK and I advice you to take a look to it as it's very fast and powerful tool.
    I started with this tutorial and I fast improved how you can see with the three applications that I work on (cherrytree, x-tile and nautilus pyextensions, links below).
    About using Anjuta I rather advice you Geany, then Glade with PyGTK.
    Cheers,
    Giuseppe.

  3. #3
    Join Date
    Mar 2006
    Beans
    837

    Re: almost there - need help setting up gtk dev

    @mikejonesey

    let's say you have named the file with the above source main.cpp
    Does it compile with this(in a terminal)?:
    Code:
    g++ main.cpp `pkg-config gtkmm-2.4 --libs --cflags` -o test
    If not, what is the output of the terminal?

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Beans
    435
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: almost there - need help setting up gtk dev

    Quote Originally Posted by SledgeHammer_999 View Post
    @mikejonesey

    let's say you have named the file with the above source main.cpp
    Does it compile with this(in a terminal)?:
    Code:
    g++ main.cpp `pkg-config gtkmm-2.4 --libs --cflags` -o test
    If not, what is the output of the terminal?
    thanks the out put is:
    Code:
    mike@mike-laptop:~/gtk-foobar/src$ g++ main.cc `pkg-config gtkmm-2.4 --libs --cflags` -o test
    main.cc:20:28: error: libglademm/xml.h: No such file or directory
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:69,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/window.h:32,
                     from /usr/include/gtkmm-2.4/gtkmm/dialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/aboutdialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm.h:34,
                     from main.cc:22:
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:60: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:68: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:89,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/window.h:32,
                     from /usr/include/gtkmm-2.4/gtkmm/dialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/aboutdialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm.h:34,
                     from main.cc:22:
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:46: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:53: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:92,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/window.h:32,
                     from /usr/include/gtkmm-2.4/gtkmm/dialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/aboutdialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm.h:34,
                     from main.cc:22:
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:69: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:94: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:94,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/window.h:32,
                     from /usr/include/gtkmm-2.4/gtkmm/dialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/aboutdialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm.h:34,
                     from main.cc:22:
    /usr/include/gtk-2.0/gtk/gtkgamma.h:63: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkgamma.h:76: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:152,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/window.h:32,
                     from /usr/include/gtkmm-2.4/gtkmm/dialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/aboutdialog.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm.h:34,
                     from main.cc:22:
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:48: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:55: error: ‘GtkVBoxClass’ does not name a type
    main.cc: In function ‘int main(int, char**)’:
    main.cc:39: error: ‘Gnome’ was not declared in this scope
    main.cc:39: error: template argument 1 is invalid
    main.cc:39: error: invalid type in declaration before ‘;’ token
    main.cc:42: error: ‘Gnome’ is not a class or namespace
    main.cc:44: error: ISO C++ forbids declaration of ‘Gnome’ with no type
    main.cc:44: error: expected `)' before ‘::’ token
    main.cc:44: error: expected `{' before ‘::’ token
    main.cc:44: error: ‘::Glade’ has not been declared
    main.cc:44: error: ‘ex’ was not declared in this scope
    main.cc:44: error: expected `;' before ‘)’ token
    main.cc:50: error: base operand of ‘->’ is not a pointer

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Beans
    435
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: almost there - need help setting up gtk dev

    thanks, but i'd rather go for c++

  6. #6
    Join Date
    Mar 2006
    Beans
    837

    Re: almost there - need help setting up gtk dev

    It seems that you are missing the dev files. They contain the headers for the libraries. Open Synaptic(or use agt-get) and install libglademm-2.4-dev and libgtkmm-2.4-dev.

    After that give this command in a terminal and it should compile:
    Code:
    g++ main.cpp `pkg-config libglademm-2.4 gtkmm-2.4 --libs --cflags` -o test
    Also I saw your post here. I will help you set up Code::Blocks if the above command works.

  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Beans
    435
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: almost there - need help setting up gtk dev

    thanks,

    but the two packages mentioned above are already installed;

    output:
    Code:
    mike@mike-laptop:~/gtk-foobar/src$ g++ main.cc `pkg-config libglademm-2.4 gtkmm-2.4 --libs --cflags` -o test
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:69,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/libglademm-2.4/libglademm/xml.h:28,
                     from main.cc:20:
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:60: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:68: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:89,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/libglademm-2.4/libglademm/xml.h:28,
                     from main.cc:20:
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:46: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:53: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:92,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/libglademm-2.4/libglademm/xml.h:28,
                     from main.cc:20:
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:69: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:94: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:94,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/libglademm-2.4/libglademm/xml.h:28,
                     from main.cc:20:
    /usr/include/gtk-2.0/gtk/gtkgamma.h:63: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkgamma.h:76: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:152,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/libglademm-2.4/libglademm/xml.h:28,
                     from main.cc:20:
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:48: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:55: error: ‘GtkVBoxClass’ does not name a type
    and to check file does exist:
    Code:
    mike@mike-laptop:~/gtk-foobar/src$ locate libglademm/xml.h
    /usr/include/libglademm-2.4/libglademm/xml.h
    Last edited by mikejonesey; October 26th, 2009 at 09:32 PM. Reason: more info

  8. #8
    Join Date
    Mar 2006
    Beans
    837

    Re: almost there - need help setting up gtk dev

    Hmmm I don't know what's wrong. Let's try to compile a simple gtkmm program without using glademm. Put this in main.cpp:
    PHP Code:
    #include <gtkmm/button.h>
    #include <gtkmm/window.h>
    #include <gtkmm/main.h>
    #include <iostream>

    class HelloWorld : public Gtk::Window
    {

    public:
      
    HelloWorld();
      
    virtual ~HelloWorld();

    protected:
      
    //Signal handlers:
      
    void on_button_clicked();

      
    //Member widgets:
      
    Gtk::Button m_button;
    };

    HelloWorld::HelloWorld()
    m_button("Hello World")   // creates a new button with label "Hello World".
    {
      
    // Sets the border width of the window.
      
    set_border_width(10);

      
    // When the button receives the "clicked" signal, it will call the
      // on_button_clicked() method defined below.
      
    m_button.signal_clicked().connect(sigc::mem_fun(*this,
                  &
    HelloWorld::on_button_clicked));

      
    // This packs the button into the Window (a container).
      
    add(m_button);

      
    // The final step is to display this newly created widget...
      
    m_button.show();
    }

    HelloWorld::~HelloWorld()
    {
    }

    void HelloWorld::on_button_clicked()
    {
      
    std::cout << "Hello World" << std::endl;
    }

    int main (int argcchar *argv[])
    {
      
    Gtk::Main kit(argcargv);

      
    HelloWorld helloworld;
      
    //Shows the window and returns when it is closed.
      
    Gtk::Main::run(helloworld);

      return 
    0;

    And compile with:
    Code:
    g++ main.cpp `pkg-config gtkmm-2.4 --libs --cflags` -o test

  9. #9
    Join Date
    Sep 2009
    Location
    UK
    Beans
    435
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: almost there - need help setting up gtk dev



    Code:
    mike@mike-laptop:~$ mkdir newtest
    mike@mike-laptop:~$ cd newtest
    mike@mike-laptop:~/newtest$ dir
    mike@mike-laptop:~/newtest$ gedit main.cpp
    mike@mike-laptop:~/newtest$ g++ main.cpp `pkg-config gtkmm-2.4 --libs --cflags` -o test
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:69,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/button.h:30,
                     from main.cpp:1:
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:60: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkcolorsel.h:68: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:89,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/button.h:30,
                     from main.cpp:1:
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:46: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfilechooserwidget.h:53: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:92,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/button.h:30,
                     from main.cpp:1:
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:69: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkfontsel.h:94: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:94,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/button.h:30,
                     from main.cpp:1:
    /usr/include/gtk-2.0/gtk/gtkgamma.h:63: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkgamma.h:76: error: ‘GtkVBoxClass’ does not name a type
    In file included from /usr/include/gtk-2.0/gtk/gtk.h:152,
                     from /usr/include/gtkmm-2.4/gtkmm/targetentry.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/targetlist.h:28,
                     from /usr/include/gtkmm-2.4/gtkmm/widget.h:46,
                     from /usr/include/gtkmm-2.4/gtkmm/container.h:29,
                     from /usr/include/gtkmm-2.4/gtkmm/bin.h:30,
                     from /usr/include/gtkmm-2.4/gtkmm/button.h:30,
                     from main.cpp:1:
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:48: error: ‘GtkVBox’ does not name a type
    /usr/include/gtk-2.0/gtk/gtkrecentchooserwidget.h:55: error: ‘GtkVBoxClass’ does not name a type
    mike@mike-laptop:~/newtest$

  10. #10
    Join Date
    Mar 2006
    Beans
    837

    Re: almost there - need help setting up gtk dev

    It compiles on my computer and should on yours. What version of ubuntu do you use?
    Reinstall the libgtkmm-2.4-dev package. Maybe it will solve the problems.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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