Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 345aa895e80053137c21f8693106c3a0 > files > 149

gtkmm2.4-documentation-2.17.4-1mdv2010.0.noarch.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Headers and Linking</title>
<link rel="stylesheet" href="style.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Programming with gtkmm">
<link rel="up" href="chapter-basics.html" title="Chapter 3. Basics">
<link rel="prev" href="chapter-basics.html" title="Chapter 3. Basics">
<link rel="next" href="sec-widgets-overview.html" title="Widgets">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Headers and Linking</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="chapter-basics.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<th width="60%" align="center">Chapter 3. Basics</th>
<td width="20%" align="right"> <a accesskey="n" href="sec-widgets-overview.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="Headers and Linking">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="sec-headers-and-linking"></a>Headers and Linking</h2></div></div></div>
<p>
Although we have shown the compilation command for the simple example, you really should use the automake and autoconf tools, as described in "Autoconf, Automake, Libtool", by G. V. Vaughan et al. The examples used in this book are included in the <span class="application">gtkmm</span> package, with appropriate build files, so we won't show the build commands in future. You'll just need to find the appropriate directory and type <code class="literal">make</code>.
</p>
<p>
To simplify compilation, we use <code class="literal">pkg-config</code>, which
is present in all (properly installed) <span class="application">gtkmm</span> installations.  This
program 'knows' what compiler switches are needed to compile programs
that use <span class="application">gtkmm</span>.  The <code class="literal">--cflags</code> option causes
<code class="literal">pkg-config</code> to output a list of include directories for the
compiler to look in; the <code class="literal">--libs</code> option requests the
list of libraries for the compiler to link with and the directories to
find them in. Try running it from your shell-prompt to see the results on your system.
</p>
<p>
However, this is even simpler when using the <code class="function">PKG_CHECK_MODULES()</code> macro in a standard configure.ac file with autoconf and automake.
For instance:
</p>
<pre class="programlisting">PKG_CHECK_MODULES([MYAPP], [gtkmm-2.4 &gt;= 2.8.0])</pre>
<p>
This checks for the presence of gtkmm and defines MYAPP_LIBS and MYAPP_CFLAGS for use in your Makefile.am files.
</p>
<p>gtkmm-2.4 is the name of the current stable API. There was an older API called gtkmm-2-0 which installs in parallel when it is available. There are several versions of gtkmm-2.4, such as gtkmm 2.10. Note that the API name does not change for every version because that would be an incompatible API and ABI break. Theoretically, there might be a future gtkmm-3.0 API which would install in parallel with gtkmm-2.4 without affecting existing applications.
</p>
<p>Note that if you mention extra modules in addition to gtkmm-2.4, they should be separated by spaces, not commas.
</p>
<p>
Openismus has more <a class="ulink" href="http://www.openismus.com/documents/linux/automake/automake.shtml" target="_top">basic help with automake and autoconf</a>.
</p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="chapter-basics.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<td width="20%" align="center"><a accesskey="u" href="chapter-basics.html"><img src="icons/up.png" alt="Up"></a></td>
<td width="40%" align="right"> <a accesskey="n" href="sec-widgets-overview.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 3. Basics </td>
<td width="20%" align="center"><a accesskey="h" href="index.html"><img src="icons/home.png" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Widgets</td>
</tr>
</table>
</div>
</body>
</html>