How do I get GTK includes to work with C++?


Gillis

I'm trying to start learning to develop GTK+ applications on Ubuntu 17.04 64bit using C++ and the Eclipse CDT IDE, and I'm having trouble trying to include the GTK library. I'm wondering why the include doesn't work. I've installed gtk 2.0 (DEV) and recently gtk 3.0 to see if that helps. Below is my code:

#include <iostream>
#include <gtk/gtk.h>

int main()
{
    return 0;
}

I am using the following compiler flags:

-I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -O0 -g3 -Wall -c -
fmessage-length=0

I get the following error from the compiler:

g++ -I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -O0 -g3 -Wall -c -
fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.o" -o "main.o" 
"../main.cpp"
In file included from /usr/include/glib-2.0/glib/galloca.h:32:0,
             from /usr/include/glib-2.0/glib.h:30,
             from /usr/include/gtk-3.0/gdk/gdkconfig.h:13,
             from /usr/include/gtk-3.0/gdk/gdk.h:30,
             from /usr/include/gtk-3.0/gtk/gtk.h:30,
             from ../main.cpp:2:
/usr/include/glib-2.0/glib/gtypes.h:32:24: fatal error: glibconfig.h: 
No such file or directory
 #include <glibconfig.h>
                    ^
compilation terminated.
make: *** [main.o] Error 1
subdir.mk:18: recipe for target 'main.o' failed
Gillis

To use pkg-config on the compiler flags, you need to include the gtk+-2.0 library and its dependencies. Adding this to your compiler command solves the problem.

In Eclipse CDT, this can be found in Project Properties -> C/C++ Build -> Settings -> GCC C++ Compiler, then edit "Command".

g++ `pkg-config --cflags --libs gtk+-2.0`

Related


How do I get GTK includes to work with C++?

Gillis I'm trying to start learning to develop GTK+ applications on Ubuntu 17.04 64bit using C++ and the Eclipse CDT IDE, and I'm having trouble trying to include the GTK library. I'm wondering why the include doesn't work. I've installed gtk 2.0 (DEV) and rec

How do I get GTK includes to work with C++?

Gillis I'm trying to start learning to develop GTK+ applications on Ubuntu 17.04 64bit using C++ and the Eclipse CDT IDE, and I'm having trouble trying to include the GTK library. I'm wondering why the include doesn't work. I've installed gtk 2.0 (DEV) and rec

How do I get GTK includes to work with C++?

Gillis I'm trying to start learning to develop GTK+ applications on Ubuntu 17.04 64bit using C++ and the Eclipse CDT IDE, and I'm having trouble trying to include the GTK library. I'm wondering why the include doesn't work. I've installed gtk 2.0 (DEV) and rec

How do I get GTK includes to work with C++?

Gillis I'm trying to start learning to develop GTK+ applications on Ubuntu 17.04 64bit using C++ and the Eclipse CDT IDE, and I'm having trouble trying to include the GTK library. I'm wondering why the include doesn't work. I've installed gtk 2.0 (DEV) and rec

How do I get this C code to work?

Caesar 381 My knowledge is limited so bear with me, but I'm trying to create functions and this is what I've got so far and it's not. Thanks for all suggestions! Try creating a function that collects user input #include<stdio.h> int GetIntFromUser(int grades[

How do I get GTK to recognize the templates I create?

Tristan 957 The repo is here : https://gitlab.com/tristan957/tllt-cp The program compiles smoothly. I have some unused variables, but this is fine. When running, I see the following warning and the GUI I'm running is not the same as the template provided. (tll

How do I get GTK to recognize the templates I create?

Tristan 957 The repo is here : https://gitlab.com/tristan957/tllt-cp The program compiles smoothly. I have some unused variables, but this is fine. When running, I see the following warning and the GUI I'm running is not the same as the template provided. (tll

How to do nested includes in angular work?

Manolovnikola I can't get nested includes to work. There are two directives, both of which declare that they will contain their content. When I nest them, there is nothing inside. Below is this fiddle that demonstrates my problem. Here is the code: function Ct

How do I get @ParametersAreNonnullByDefault to work?

good: I've made several attempts to get the package annotation @ParametersAreNonnullByDefault to work for me in a maven project without success. Can someone share a link to a minimal/example Maven project? I'm talking about letting the findbugs processor imple

How do I get AssImp to work?

light spark I've been trying to do this for about a week now, and still nothing works. I'm building a .dll (UNDONE Engine .dll) that depends on Assimp to load the model. The .dll compiles and links perfectly, but when I try to use it for some applications I ge

How do I get Mockito to work in androidTest

Isaro How can I mock a class I wrote in a test? Here is my test code: import android.support.test.runner.AndroidJUnit4; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotat

How do I get pyinstaller to work on Ubuntu?

microphone I'm using Ubuntu 16 and have installed Python 3.5, also installed pip3, and installed PyInstaller using pip3. I can't run PyInstaller. Whenever I enter pyinstaller in the terminal, I get the following error? do i have to add the path? If so, what sh

How do I get Xdebug to work on Heroku?

Nino Škopac I just pushed a new deployment to a staging instance on Heroku which failed and now my site has a 500 error. composer.json { "license": "proprietary", "require": { "php": ">=5.5.16", "aws/aws-sdk-php": "2.*", "ext-me

How do I get "Observable.of([]);" to work?

rose cleaner What is the correct expression and import Observable.of([]);. import { of } from 'rxjs';doesn't work for me. Martin As of RxJS 6, you should import all "create" observables directly from it 'rxjs'(assuming path mappings are set up when bundling th

How do I get the click catcher to work?

Excellent SP I'm trying to create a simple click catcher, if you click .image-classjavascript it will get the href from another element with the class name .btnand send it to the destination. Although I keep getting errors on lines 7 and 10 that undefined is n

How do I get AssImp to work?

light spark I've been trying to do this for about a week now, and still nothing works. I'm building a .dll (UNDONE Engine .dll) that depends on Assimp to load the model. The .dll compiles and links perfectly, but when I try to use it for some applications I ge

How do I get my torrents to work?

Aelo-74 I'm still new to Ruby/Rails and need your help to make sure the seed is good before running the command.rails db:seed Here is my seed: require 'faker' puts "Creating 10 fake user heros..." 10.times do user = User.create!( username: Faker::DcComi

How do I get pygame collision to work

Crowley I'm making a copy of a flying bird and can't get the collision mechanism to work. Currently, I'm trying to use, .coliderect()but I'm not 100% sure how. Here are two classes. I want the program to do something, or just do something print('x')when the bi

How do I get jQuery to work with me?

Denislav Karagizov I am making an accordion. Watch a guy on youtube do this and write everything his way and it works on his video but not on my computer. Here's what I do (yes, I do declare the HTML at the beginning, and yes, I have the HTML turned on and off

How do I get Tomboy Sync to work?

Jared Kay So after a fresh install of 12.04, I can't get my Tomboy to sync now. I can't get close to 100 important notes right now because "Notes" has also been removed from "Ubuntu One". When I try to "sync" my notes, I get the error "sync failed". Does anyon

How do I get @ParametersAreNonnullByDefault to work?

good: I've made several attempts to get the package annotation @ParametersAreNonnullByDefault to work for me in a maven project without success. Can someone share a link to a minimal/example Maven project? I'm talking about letting the findbugs processor imple

How do I get VBS files to work?

stub When I try to batch create vbs file, the line is not showing in vbs file echo WScript.Sleep 2000 : Objshell.Run "taskkill /f /im cmd.exe", 0 >> 2.vbs What do I need to escape or make the vbs file runnable? Thanks! Hack I created a new batch code to make l

How do I get these queries to work together?

Ryan The query asks to find sets of courses whose combination covers all the knowledge/skills one lacks in pursuit of pos_code. The set of courses considered will not exceed three courses. If more than one course set is found, list the course sets (and their c

How do I get VBS files to work?

stub When I try to batch create vbs file, the line is not showing in vbs file echo WScript.Sleep 2000 : Objshell.Run "taskkill /f /im cmd.exe", 0 >> 2.vbs What do I need to escape or make the vbs file runnable? Thanks! Hack I created a new batch code to make l

How do I get pywinauto to work in the background?

List I would like to use pywinauto in the background to avoid interfering with my work. I need to stop all work as automation starts. How can I make pywinauto run silently in the background? Vasily Ryabov It's not always possible to do everything silently. Som

How do I get the clicked() function to work?

TheCodedMaster cube I'm working with the Coding Train Coding Challenge, Challenge #6: Mitosis. I'm stuck on the part where one of the cell clicks should be detected. If you put this into a web browser, you'll see what I mean - it says it , and it says it quick

How do I get my torrents to work?

Aelo-74 I'm still new to Ruby/Rails and need your help to make sure the seed is good before running the command.rails db:seed Here is my seed: require 'faker' puts "Creating 10 fake user heros..." 10.times do user = User.create!( username: Faker::DcComi

How do I get the sensor applet to work?

OK I used to have lm-sensorsit and it sensors-appletworked fine on Ubuntu 11.04. I just updated to Ubuntu 11.10 and lm-sensorsit's installed, but it doesn't seem to exist in the repositories anymore. Is there a way to keep it working?sensors-applet Mahelita In