LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-24-2013, 07:32 PM   #1
NeXuS_2006
Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 64

Rep: Reputation: 18
GTK+-3.0-dev No Such File Or Directory on compile (Linux Mint/gcc)


I'm taking my first foray into C/C++/GTK, and having trouble getting a basic GTK+ program to compile. I have sample.c. If I try to compile it with

Code:
$ gcc sample.c -o sample 'pkg-config --cflags --libs gtk+-3.0'
It complains about the package being unavailable.

Code:
Package gtk+3.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `gtk+3.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'gtk+3.0' found
To troubleshoot, I have tried:

Code:
$ gcc sample.c -o sample
I get gtk/gtk.h No Such File Or Directory, obviously.

When I try

Code:
$ pkg-config --cflags gtk+-3.0
I get

Code:
-pthread -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12
and

Code:
$ pkg-config --libs gtk+-3.0
gives me this:

Code:
Package gtk+3.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `gtk+3.0.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'gtk+3.0' found
I am using a fresh install of Mint 15, and I have libgtk-3-dev and gtk+3.0 installed via apt-get, dependencies are satisfied. I know its basic, but I can't quite wrap my head around what I need to do.
 
Old 07-24-2013, 07:50 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

are you 100% sure you install libgtk-3-dev? What does the following output?
Code:
dpkg -l libgtk-3-dev
Evo2.
 
Old 07-24-2013, 07:57 PM   #3
NeXuS_2006
Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 64

Original Poster
Rep: Reputation: 18
Code:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  libgtk-3-dev   3.6.4-0ubunt amd64        development files for the GTK+ li
I installed it this way:
Code:
nexus@Lithium ~ $ sudo apt-get install libgtk-3-dev
[sudo] password for nexus: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgtk-3-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
 
Old 07-24-2013, 08:17 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

ok that is really strange. On my Debian Wheezy machine, if I have that package installed pkg-config will find gtk+3.0. If I remove that package, pkg-config returns _ALMOST_ the same errors that you see - the error message you have posted is for "gtk+3.0", not "gtk+-3.0". Can you check you didn't make a typo?

Evo2.
 
Old 07-24-2013, 08:32 PM   #5
NeXuS_2006
Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 64

Original Poster
Rep: Reputation: 18
Here is the terminal log, no typos that I'm aware of:
Code:
nexus@Lithium ~ $ pkg-config --libs gtk+-3.0
-lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0  
nexus@Lithium ~ $ pkg-config --cflags gtk+-3.0
-pthread -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12  
nexus@Lithium ~ $ cd Desktop/
nexus@Lithium ~/Desktop $ gcc simple.c -o simple 'pkg-config --cflags gtk+-3.0 --libs gkt+-3.0'
gcc: error: pkg-config --cflags gtk+-3.0 --libs gkt+-3.0: No such file or directory
I removed and re-installed the package. Then I started messing with dpkg just to check...

Code:
$ dpkg -L libgtk-3-dev
It returned all the files, right where they should be in /usr/include/gtk-3.0

Last edited by NeXuS_2006; 07-24-2013 at 08:41 PM.
 
Old 07-24-2013, 08:40 PM   #6
NeXuS_2006
Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 64

Original Poster
Rep: Reputation: 18
OK...it gets weirder. I did this:

Code:
 pkg-config --cflags --libs gtk+-3.0
copied and pasted the output like so:

Code:
nexus@Lithium ~/Desktop $ gcc simple.c -o simple -lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -pthread -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12
and the program compiled successfully, and runs correctly.

So, to recap:

Code:
$ gcc simple.c -o simple 'pkg-config --cflags --libs gtk+-3.0'
does not work, because it can't find the appropriate files, while

Code:
$ gcc simple.c -o simple {copied and pasted output of pkg-config --cflags --libs gtk+-3.0}
works perfectly.
 
Old 07-24-2013, 08:41 PM   #7
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

ok, now I see the problem: you are using single quotes like: ', where you should be using backticks: `.
Backticks will make the command be executed and the output will be put on the command line.

Eg compare the output of the following
Code:
echo "The flags are 'pkg-config --cflags gtk+-3.0'"
to
Code:
echo "The flags are `pkg-config --cflags gtk+-3.0`"
Or instead of using backticks you can use $().

Eg
Code:
echo "The flags are $(pkg-config --cflags gtk+-3.0)

Evo2.
 
1 members found this post helpful.
Old 07-24-2013, 08:49 PM   #8
NeXuS_2006
Member
 
Registered: Dec 2003
Distribution: Fedora
Posts: 64

Original Poster
Rep: Reputation: 18
Ohhhhh, those are backticks. LOL, got it!
 
  


Reply

Tags
gcc, gtk+, pkg-config



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not compile gcc, fatal error: stdio.h: No such file or directory StefanTh Linux - Newbie 6 02-10-2014 12:06 AM
gcc giving error linux/init.h: No such file or directory chandramohan N Debian 4 02-06-2012 02:44 AM
[SOLVED] error: gtk/gtk.h: No such file or directory Aquarius_Girl Programming 6 03-28-2011 04:17 AM
gcc error: iostream: no such file or directory linux 4.1.2 Liah Linux - Newbie 1 03-10-2009 10:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration