Skip to content
Advertisement

Ubuntu GTK+3 Eclipse Link

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…

Advertisement

Answer

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 😉

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement