Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > e40b0b2b839eccdb3c85993a7b738115 > files > 185

gtkmm-documentation-3.24.0-1.mga7.noarch.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Headers and Linking</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Programming with gtkmm 3">
<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">
<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-documentation</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-3.0 &gt;= 3.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-3.0 is the name of the current stable API. There was an older API called gtkmm-2-4 which installs in parallel when it is available. There were several versions of gtkmm-2.4, such as gtkmm 2.10 and there are several versions of the gtkmm-3.0 API. 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-4.0 API which would install in parallel with gtkmm-3.0 without affecting existing applications.
</p>
<p>Note that if you mention extra modules in addition to gtkmm-3.0, they should be separated by spaces, not commas.
</p>
<p>The GNU site has more information about <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top">autoconf</a>
and <a class="ulink" href="https://www.gnu.org/software/automake/" target="_top">automake</a>.
</p>
<p>If you start by experimenting with a small application that you plan to use just for yourself,
it's easier to start with a Makefile similar to the <code class="filename">Makefile.example</code> files
in the <a class="link" href="chapter-building-applications.html" title="Chapter 31. Building applications">Building applications</a> chapter.
</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>