LinuxQuestions.org
Review your favorite Linux distribution.
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 08-07-2010, 03:34 PM   #1
larsmw
LQ Newbie
 
Registered: Aug 2010
Location: Denmark
Distribution: Debian lenny
Posts: 10

Rep: Reputation: 0
gnu autotools and gtk+-2 ?


Hi
I am about to make an application from scratch but have allready run into troubles! :-)

I have made a basic setup with configure.ac, Makefile.in etc. By running autoconf, autoheader and automake the configure script gets created as supposed. And the run of configure also seems fine (no errors).

But when i run make the compilation cannot find the gtk/gtk.h header on my system (it is in /usr/include/gtk-2.0/gtk/gtk.h )

You can see my source here : http://code.google.com/p/gtkfractals...wse/#svn/trunk

How du I put the correct -I/usr/include... and -L/usr/include... options into the makefile?

regards
Lars Nielsen
 
Old 08-08-2010, 08:57 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
You will have to use 'pkgconfig'.
gtk+-2 has these ".pc" files (also referred to as 'package') :
/usr/lib/pkgconfig/gdk-2.0.pc
/usr/lib/pkgconfig/gdk-x11-2.0.pc
/usr/lib/pkgconfig/gtk+-2.0.pc
/usr/lib/pkgconfig/gtk+-unix-print-2.0.pc
/usr/lib/pkgconfig/gtk+-x11-2.0.pc

I guess, that some pkgconfig recognition is part of autotools.
Some Makefile.in have this line only : PKG_CONFIG = @PKG_CONFIG@
( Please see for yourself in a gtk application or
the gtk+-2 source code itself.)

Examples : Google .. how makefile.in pkgconfig ..
http://www.google.com/webhp#hl=en&q=...ba07cc1e57261b

First hit :
http://www.aleksey.com/xmlsec/api/xm...ling-unix.html

etc. etc.
..
Good luck !
 
1 members found this post helpful.
Old 08-08-2010, 03:41 PM   #3
larsmw
LQ Newbie
 
Registered: Aug 2010
Location: Denmark
Distribution: Debian lenny
Posts: 10

Original Poster
Rep: Reputation: 0
Smile Thanks!

Thanks a lot Knud! :-)

I found this link from your google-search : http://www.mrpt.org/node/74

I modified lines 2-3 in src/Makefile.am :
1. bin_PROGRAMS = fractals
2. CXXFLAGS += `pkg-config --cflags gtk+-2.0`
3. LDFLAGS += `pkg-config --libs gtk+-2.0`
4. fractals_SOURCES = main.cpp

And now it works! :-)
I just had to use CXXFLAGS because I use C++ and not C

Regards
Lars Nielsen
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: A brief introduction to the GNU Autotools LXer Syndicated Linux News 0 05-17-2008 06:41 AM
GNU autotools, Anjuta, wxWidgets skka Linux - Newbie 2 03-08-2006 02:00 AM
Using GNU autotools properly MadCactus Linux - Software 0 08-19-2004 07:36 AM
GNU autotools in Rh 9 broken? Worked fine in 7.3... rylan76 Red Hat 1 04-17-2004 02:27 PM
Gnu Autotools jinksys Programming 0 10-08-2003 12:26 AM

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

All times are GMT -5. The time now is 08:15 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