1

I am trying to create a GUI using GTKmm in Eclipse, however I can't get the configuration working. For reference, here is my actual code:

#include <gtkmm.h>

using namespace std;

int main(int argc, char **argv) {
    Gtk::Main kit(argc,argv);
    Gtk::Window frmMain;

    kit.run(frmMain);

    return 0;
}

These are the settings I have entered under the GCC C++ Compiler section. All options:

-I/usr/include/gtkmm-3.0 -I/usr/include/gdkmm-3.0 -I/usr/include/gtk-3.0 -O0 -g3 -Wall

and for Command Line Pattern:

${COMMAND} `pkg-config gtkmm-3.0 --cflags` ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}

Finally, under the GCC G++ Linker section, I have this entered for the Command Line Pattern:

${COMMAND} `pkg-config gtkmm-3.0 --libs` ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${FLAGS}

Here is a link to my compile log: http://pastebin.com/tfqv97w6

  • It looks like inserting `pkg-config gtkmm-3.0 --libs` in the command there is not enough to make this work. I do have a good solution for this give me a couple of minutes to get the info – Galik Sep 27 '14 at 21:02
  • I installed a plugin for eclipse that interfaces with pkg-config and allows you to select the pagkage from a list and hey-presto! https://code.google.com/p/pkg-config-support-for-eclipse-cdt/ – Galik Sep 27 '14 at 21:05
  • @Galik Wow, that one speedy response.. take all the time you need :) –  Sep 27 '14 at 21:05
  • I added the plugin you suggested, and checked a few of the boxes that looked relevant, but that doesn't seem to have changed anything. –  Sep 27 '14 at 21:23
  • Did you put back the command line pattern to how it was before? – Galik Sep 27 '14 at 21:40
  • No, but let me try that now. –  Sep 27 '14 at 21:46
  • That seems to have fixed it a little bit, but it can't find glibmm.h http://pastebin.com/7YrJiNNn –  Sep 27 '14 at 21:50
  • Have you installed the development libraries for gtkmm-3.0? They are usual the same as the library package name with `-devel` or `-dev` appended to the end – Galik Sep 27 '14 at 22:04
  • Actually it looks like you didn't check the `glibmm-2.4` option in pkg-config. – Galik Sep 27 '14 at 22:10
  • The plugin you suggested doesn't seem to be working... I started adding the output from `pkg-config gtkmm-3.0 --cflags` to the includes manually, and it seems to be fixing the errors I'm getting one at a time. If you know of an easier way to to this, let me know. Here is the latest output of the compiler btw. http://pastebin.com/9142UxNQ –  Sep 28 '14 at 18:16

3 Answers3

0

I can't put this in the comments they are too restrictive. These are the steps I have just gone through to make a gtkmm program in my eclipse. I followed the procedure twice and it worked both times.

Create Project:

File -> New -> C++ Project

Project Type: Executable -> Hellow World Gtkmm Project

Toolchains: Linux GCC

Project Properties:

C/C++ Build -> Settings -> Pkg-config -> gtkmm-3.0

See if that works for you.

Galik
  • 47,303
  • 4
  • 80
  • 117
0

I performed two test. One with your source instance and one with an instance from a simple file from the site. Both worked flawlessly the first time using the steps below.

A Hello World example from the gtkmm website with Success: https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/helloworld

First I installed the pkg-config Eclipse Plugin:
https://code.google.com/p/pkg-config-support-for-eclipse-cdt/

Then:

  • Created a new empty C++ project in Eclipse
  • Added three files to the project (helloworld.cpp, helloworld.h, main.cc)
  • Added pkg-config-support to the project: [(right click on Project) -> Properties -> C++ Build -> Settings -> Pkg-config -> (checkmark) gtkmm-3.0 -> OK
  • From Eclipse I Cleaned, then Build all, then was able to Run the example.
murrayc
  • 2,103
  • 4
  • 17
  • 32
L. D. James
  • 1,679
  • 1
  • 22
  • 35
0

I have a brief article about this (with screenshots), see it here:

http://www.hamedandobaideh.com/index.php/9-uncategorised/73-gtkmm-with-eclipse

Justin Pearce
  • 4,994
  • 2
  • 24
  • 37
  • A link to a potential solution is always welcome, but please [add context around the link](http://meta.stackoverflow.com/a/8259/169503) so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. Take into account that being _barely more than a link to an external site_ is a possible reason as to [Why and how are some answers deleted?](http://stackoverflow.com/help/deleted-answers). – Xavi López Aug 05 '15 at 14:16