Results 1 to 10 of 10

Thread: Errors while compiling gtkmm 3.0 programs

  1. #1
    Join Date
    Sep 2009
    Location
    Jupiter
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Question Errors while compiling gtkmm 3.0 programs

    I've recently downloaded and installed gtkmm 3.0 and tried to compile hello world example from their documentation

    PHP Code:
    #include <gtkmm.h>

    int main(int argcchar *argv[])
    {
      
    Glib::RefPtr<Gtk::Applicationapp =
        
    Gtk::Application::create(argcargv,
          
    "org.gtkmm.examples.base");

      
    Gtk::ApplicationWindow window;

      return 
    app->run(window);


    but it fails to compile and I get the following errors

    searock@searock:~/snippets$ g++ test.cc -o test `pkg-config gtkmm-3.0 --cflags --libs`
    test.cc: In function ‘int main(int, char**)’:
    test.cc:5:16: error: ‘Application’ is not a member of ‘Gtk’
    test.cc:5:16: error: ‘Application’ is not a member of ‘Gtk’
    test.cc:5:32: error: template argument 1 is invalid
    test.cc:5:38: error: invalid type in declaration before ‘=’ token
    test.cc:6:10: error: ‘Gtk::Application’ has not been declared
    test.cc:9:3: error: ‘ApplicationWindow’ is not a member of ‘Gtk’
    test.cc:9:26: error: expected ‘;’ before ‘window’
    test.cc:11:13: error: base operand of ‘->’ is not a pointer
    test.cc:11:19: error: ‘window’ was not declared in this scope
    When I tried searching for the errors I found that Gtk::Application::create method is available from gtkmm 3.4 and my version is gtkmm 3.0

    And I also found another snippet which compiled and ran successfully.

    PHP Code:
    #include <gtkmm.h>

    int main(int argcchar *argv[]) {
        
    Gtk::Main kit(argcargv);
        
    Gtk::Window window;
        
    Gtk::Main::run(window);
        return 
    0;

    Does this mean that examples in official gtkmm documentation will only work in 3.4 or above?

    Do they have a documentation for 3.0 version?

    I'm confused as they have only released unstable version upto gtkmm 3.1

  2. #2
    Join Date
    Jul 2009
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Errors while compiling gtkmm 3.0 programs

    You can run:

    Code:
    $pkg-config --modversion gtkmm-3.0
    to see which version of gtkmm you use. And indeed, Gtk::Application is introduced in version 3.4 and since that version using Gtk::Main is deprecated.
    Recent versions of ubuntu ship with a recent version of gtkmm, at least 12.04 does.
    Windows DOS not compute...

  3. #3
    Join Date
    Aug 2012
    Beans
    185

    Re: Errors while compiling gtkmm 3.0 programs

    If you download and install Gtk(mm) yourself then you either love pain or hacking.
    Spare yourself hours/days/weeks of troubles and install a recent version of Ubuntu which comes with a recent version of gtk(mm). Ubuntu 10.04 is history.
    Last edited by bird1500; December 6th, 2012 at 04:54 PM.

  4. #4
    Join Date
    Sep 2009
    Location
    Jupiter
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Errors while compiling gtkmm 3.0 programs

    Quote Originally Posted by Hetepeperfan View Post
    You can run:

    Code:
    $pkg-config --modversion gtkmm-3.0
    to see which version of gtkmm you use. And indeed, Gtk::Application is introduced in version 3.4 and since that version using Gtk::Main is deprecated.
    Recent versions of ubuntu ship with a recent version of gtkmm, at least 12.04 does.
    I've two machines one with 11.10 and other with 12.10 (gnome remix)

    So I've downloaded and installed gtkmm 3.0 in 11.10 and I get the three versions for
    Code:
    $pkg-config --modversion gtkmm-3.0
    gtkmm 2.4
    gtkmm 3.0
    gtkmm 3.0-dev

    (I guess it was prefixed with lib-)

    while in 12.10 it says

    Package gtkmm-3.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `gtkmm-3.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'gtkmm-3.0' found
    I even tried running
    Code:
    dpkg -l |grep gtkmm
    and it shows me the following output in 12.10

    libgtkmm-3.0-1:amd64 3.5.13-0ubuntu1 amd64 C++ wrappers for GTK+ (shared libraries)
    I can't compile the program in 12.10 as it says

    Code:
    Package gtkmm-3.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `gtkmm-3.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'gtkmm-3.0' found
    test.cc:1:20: fatal error: gtkmm.h: No such file or directory
    compilation terminated.
    Quote Originally Posted by bird1500 View Post
    If you download and install Gtk(mm) yourself then you either love pain or hacking.
    Spare yourself hours/days/weeks of troubles and install a recent version of Ubuntu which comes with a recent version of gtk(mm). Ubuntu 10.04 is history.
    I didn't know it would be such a pain

    Is it possible to run the programs on 12.10 (gnome remix)?
    Last edited by Searock; December 6th, 2012 at 09:56 PM.

  5. #5
    Join Date
    Mar 2006
    Beans
    837

    Re: Errors while compiling gtkmm 3.0 programs

    In 12.10 do a:

    PHP Code:
    pkg-config --list-all grep -i gtkmm 
    Does it return anything?

    Have you installed the libgtkmm-3.0-dev package?

  6. #6
    Join Date
    Sep 2009
    Location
    Jupiter
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Errors while compiling gtkmm 3.0 programs

    Quote Originally Posted by SledgeHammer_999 View Post
    In 12.10 do a:

    PHP Code:
    pkg-config --list-all grep -i gtkmm 
    Does it return anything?

    Have you installed the libgtkmm-3.0-dev package?
    It displays nothing for 12.10 and I get the following result for 11.10

    gtkmm-3.0 gtkmm - C++ binding for the GTK+ toolkit

  7. #7
    Join Date
    Mar 2006
    Beans
    837

    Re: Errors while compiling gtkmm 3.0 programs

    I installed 12.10 in a Virtual Machine to check this out.

    You should:
    1. Run "sudo apt-get update"
    2. Run "sudo apt-get install libgtkmm-3.0-dev"
    3. Now "pkg-config --list-all | grep -i gtkmm" should give a 3.0 entry

    If you cannot find the "libgtkmm-3.0-dev" package you should try to change the mirror apt/synaptic/software center uses. The default mirror may be corrupted.
    If you already have installed the "libgtkmm-3.0-dev" package you should try reinstalling it.

    If all this fail I don't know what else could be wrong with your install.

  8. #8
    Join Date
    Sep 2009
    Location
    Jupiter
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Errors while compiling gtkmm 3.0 programs

    Quote Originally Posted by SledgeHammer_999 View Post
    I installed 12.10 in a Virtual Machine to check this out.

    You should:
    1. Run "sudo apt-get update"
    2. Run "sudo apt-get install libgtkmm-3.0-dev"
    3. Now "pkg-config --list-all | grep -i gtkmm" should give a 3.0 entry

    If you cannot find the "libgtkmm-3.0-dev" package you should try to change the mirror apt/synaptic/software center uses. The default mirror may be corrupted.
    If you already have installed the "libgtkmm-3.0-dev" package you should try reinstalling it.

    If all this fail I don't know what else could be wrong with your install.
    Thanks a lot SledgeHammer. Its working as expected. Thanks for all the help

  9. #9
    Join Date
    Mar 2006
    Beans
    837

    Re: Errors while compiling gtkmm 3.0 programs

    What did you do to fix it?

  10. #10
    Join Date
    Sep 2009
    Location
    Jupiter
    Beans
    29
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Errors while compiling gtkmm 3.0 programs

    Quote Originally Posted by SledgeHammer_999 View Post
    What did you do to fix it?
    Installing libgtkmm-3.0-dev solved my problem. Thanks for the help.

Tags for this Thread

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
  •