a7c1 [Solved] unable to link in gtk+ libs with pkg-config - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Development > Userland Programming & Scripting

Userland Programming & Scripting C, Shell, Perl, Sed & Awk

Reply
 
Thread Tools Display Modes
  #1  
Old May 24th, 2010, 04:18
DaveFBSD DaveFBSD is offline
Junior Member
 
Join Date: May 2010
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default unable to link in gtk+ libs with pkg-config

Hello,

I'm trying to teach myself how to create graphical applications using gtk+, but can't seem to even make it through step 1 of the tutorial:

http://library.gnome.org/devel/gtk-tutorial/stable/

I've been searching online, digging through man pages, and trying various experiments to see if I could figure it out myself, but after several days of trying am at the end of my rope. I'm really hoping someone here can show me the error of my ways.

I'm running FreeBSD 8.0. I thought the problem might be something I did to screw up the system, so I even tried a fresh install from the CD (I'm running FreeBSD inside a virtual machine using VirtualBox). On the fresh install, I installed gtk+ as a package, along with all the dependencies, using sysinstall.

My problem is that when I try to compile the "getting started" program (base.c), I get the following error:
Code:
$ gcc base.c -o base 'pkg-config --cflags --libs gtk+-2.0'
gcc: pkg-config --cflags --libs gtk+-2.0: No such file or directory
base.c:1:21: error: gtk/gtk.h: No such file or directory
There are other compile errors which follow, all of which should be attributable to the fact that the compiler can't find gtk.h, so I won't repeat them here.

gtk+-2.0.pc is in the directory /usr/local/libdata/pkgconfig, so I created and exported the environment variable PKG_CONFIG_PATH, as described in the man page for pkg-config:

Code:
$ PKG_CONFIG_PATH=/usr/local/libdata/pkgconfig
$ export PKG
$ echo $PKG_CONFIG_PATH
/usr/local/libdata/pkgconfig
I know that pkg-config is seeing gtk+-2.0.pc, because running the command on its own produces (what appears to be) the desired output:

Code:
$pkg-config --cflags --libs gtk+-2.0
-D_THREAD_SAFE -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include -I/
usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pango-
1.0 -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0
/include -I/usr/local/include/pixman-1 -I/usr/local/include/freetype2 -pthread 
-L/usr/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangoc
airo-1.0 -lgio-2.0 -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcompos
ite -lXdamage -lpangoft2-1.0 -lXfixes -lcairo -lX11 -lpango-1.0 -lm -lfreetype -
lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
So I can't figure out why gcc isn't processing the pkg-config argument correctly. Can anyone help?
Reply With Quote
  #2  
Old May 24th, 2010, 16:42
expl's Avatar
expl expl is offline
Member
 
Join Date: Oct 2009
Location: In your shell, stealing your cookies.
Posts: 639
Thanks: 0
Thanked 113 Times in 104 Posts
Default

There is difference between ` and ', use correct symbol to quote(aka first one I mentioned).
Reply With Quote
The Following User Says Thank You to expl For This Useful Post:
DaveFBSD (May 24th, 2010)
  #3  
Old May 24th, 2010, 17:59
DaveFBSD DaveFBSD is offline
Junior Member
 
Join Date: May 2010
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Wow. Can't believe I spent so much time trying to figure it out and didn't realize that. Thank you so much! Problem solved.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Boost libs bork Porting New Software 2 December 22nd, 2009 05:35
[Solved] graphics/inkscape && Related Libs (Qt!/Gtk/Gtkmm) vigol Installation and Maintenance of FreeBSD Ports or Packages 4 December 21st, 2009 23:44
What is the *@FBSD_1.1 in the libs? osx-addict General 2 October 3rd, 2009 06:57
[Solved] after run pkg_delete -rf pkg-config\* kde4.2 can not install mfaridi Installation and Maintenance of FreeBSD Ports or Packages 6 February 21st, 2009 08:03
What do pkg_delete -rf pkg-config\* mfaridi Installation and Maintenance of FreeBSD Ports or Packages 4 February 8th, 2009 22:14


All times are GMT +1. The time now is 10:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0