0
votes

Is there any simple tutorial on linking gtk+3 libraries with eclipse indigo cdt on ubuntu platform? As I googled, I have been trying to use the pkg-config commands but still getting same result; the SDK cannot resolve gtk methods.

I downloaded libgtk3-dev and gtk3 from synaptic properly.

I included all the headers properly from C++ settings - gcc compiler - includes. But what to do about gcc linker - libraries? Any tutorial on this will be appreciated. Thanks...

1
Just have a Makefile and configure Eclipse to use it. - Basile Starynkevitch
Did you read GNU make manual (it has a good tutorial)? Did you look into free software using GTK (like gedit)? There are good examples! - Basile Starynkevitch
BTW, GTK3 is mostly a C library (you'll want GtkMM or Qt if coding in C++) not a C++ one and Eclipse might not be the best editor for C programs (did you try emacs ?) - Basile Starynkevitch
I will also use gtkmm after successfully linking gtk. - baci
Consider learning GNU make and using it. It is significant that most free software projects use make for building (and most free software developers with C and C++ don't use Eclipse). - Basile Starynkevitch

1 Answers

0
votes

As I had this problem recently, I'll post here all needed to get a working gtk+ v3 project on Debian 8 with Gnome 3 and Eclipse Indigo.

First of all, ensure you have downloaded all needed packages:

root# apt-get install libgtk-3-dev gdb eclipse-cdt build-essential cmake git pkg-config

As all this software is installed, open Eclipse. We will install the Marketplace, a new eclipse feature not present in Eclipse Indigo.

Open the Help menu (in the upper File bar) and select "Install new Software". A window like this will be opened:

Click on Add... button and enter this repository: Name="Marketplace" and Location="http://download.eclipse.org/mpc/indigo/".

Once you have added the repository, you'll be able to select the Marketplace client, as shown in this image:

Select the "Marketplace client" and install it. Restart the eclipse IDE when needed.

Now you have Marketplace available, so lets use it. We need a tool called Pkg-config to configure all the GTK+ v3 libraries in our project.

Open again the Help menu and select the new "Eclipse Marketplace..." option. In the search bar, type the text "pkg-config" and you should get a screen like this:

This is the pkg-config tool for Eclipse. Press the button "Install" and restart the IDE when needed.

Now proceed creating a simple C++ project in eclipse. Once you have created it, select its main folder and go to Project > Preferences (or just right click on it and select the preferences option). You will get a preferences window, so go to C/C++ Build > Settings and select the Pkg-config tab. Now select the gtk+ 3 option from the list like this:

And all the needed configuration is ended. Close that window and build your beautiful GTK+ v3 application ;)