/usr/share/doc/libitpp-dev/html/linking.html is in libitpp-doc 4.3.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Welcome to IT++!</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div style="width: 100%; height: 40px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<a href="http://itpp.sourceforge.net"><img src="itpp_logo.png" alt="IT++ Logo" style="float: left; border: 0;"></a>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<div class="left">
<form id="FSearchBox" action="search.php" method="get">
<img id="MSearchSelect" src="search/mag.png" alt=""/>
<input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"/>
</form>
</div><div class="right"></div>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Linking with IT++ </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="toc"></a>
Table of Contents</h1>
<ul>
<li><a class="el" href="verification.html#intro">Introdution</a></li>
<li><a class="el" href="linking.html#pkgconfig">Using the pkg-config command</a></li>
<li><a class="el" href="linking.html#itppconfig">Using the itpp-config script</a></li>
<li><a class="el" href="linking.html#dynamiclinking">Using IT++ with dynamic linking</a></li>
<li><a class="el" href="linking.html#msvc_linking">Linking your own programs with IT++ using MSVC++</a></li>
<li><a class="el" href="linking.html#matlab_load_and_save">Using IT++ file format in Matlab/Octave</a></li>
<li><a class="el" href="linking.html#python_load">Using IT++ file format in Python</a></li>
</ul>
<h1><a class="anchor" id="intro"></a>
Introdution</h1>
<p>Since version 3.9.0, there are two convenient methods of linking your programs with the IT++ library. The first one employs the <code>`pkg-config'</code> command (see <a href="http://pkg-config.freedesktop.org/">http://pkg-config.freedesktop.org/</a>), wheres the second one uses the <code>`itpp-config'</code> script. These methods are shortly described below.</p>
<h1><a class="anchor" id="pkgconfig"></a>
Using the pkg-config command</h1>
<p><code>`pkg-config'</code> is a helper tool used when compiling and linking programs or libraries. It provides correct compiler and linker options (flags). The syntax of the <code>`pkg-config'</code> command is as follows:</p>
<div class="fragment"><div class="line">% pkg-config <options> <library_name></div>
</div><!-- fragment --><p>For instance, assuming that you need to compile an IT++ based program <code>`my_prog.cpp'</code>, you might use the following command:</p>
<div class="fragment"><div class="line">% g++ `pkg-config --cflags itpp` -o my_prog my_prog.cpp `pkg-config --libs itpp`</div>
</div><!-- fragment --><p>If you have installed a debugging version of the IT++ library in parallel, you can ask the <code>`pkg-config'</code> command to provide flags for it as well. Just use <code>`itpp_debug'</code> name instead of <code>`itpp'</code> in the arguments:</p>
<div class="fragment"><div class="line">% export CXXFLAGS_DEBUG=`pkg-config --cflags itpp_debug`</div>
<div class="line">% export LIBS_DEBUG=`pkg-config --libs itpp_debug`</div>
<div class="line">% g++ $CXXFLAGS_DEBUG -o my_prog my_prog.cpp $LIBS_DEBUG</div>
</div><!-- fragment --><p>Alternatively, when you have to use static linking only (e.g. in Cygwin or MinGW/MSYS), you might need to add the `–static' switch to your command:</p>
<div class="fragment"><div class="line">% export CXXFLAGS=`pkg-config --cflags itpp`</div>
<div class="line">% export LIBS=`pkg-config --<span class="keyword">static</span> --libs`</div>
<div class="line">% g++ $CXXFLAGS -o my_prog my_prog.cpp $LIBS</div>
</div><!-- fragment --><p>If `pkg-config' can not find the itpp library information, you might need to set the PKG_CONFIG_PATH environment variable with the directory where the <code>`itpp.pc'</code> file is installed (<code>`$prefix/lib/pkgconfig'</code> by default). Alternatively you can use the full path to the <code>`itpp.pc'</code> or <code>`itpp_debug.pc'</code> file, e.g.:</p>
<div class="fragment"><div class="line">% pkg-config --libs /usr/local/lib/pkgconfig/itpp.pc</div>
</div><!-- fragment --><p>For more information please refer to the <code>`pkg-config'</code> documentation.</p>
<h1><a class="anchor" id="itppconfig"></a>
Using the itpp-config script</h1>
<p>IT++ also provides a shell script called <code><code>itpp-config</code></code>, which is installed in a <code>`$prefix/bin'</code> (<code>`/usr/local/bin'</code>) directory by default. It can be used to simplify the compilation and linking of IT++ based programs. The usage of this script is quite similar to the usage of the <code>`pkg-config'</code> command.</p>
<p>Assuming that you need to compile the program <code>`my_prog.cpp'</code>, you can do that with the following command:</p>
<div class="fragment"><div class="line">% g++ `itpp-config --cflags` -o my_prog my_prog.cpp `itpp-config --libs`</div>
</div><!-- fragment --><p>The above command will result in an optimised binary <code>`my_prog'</code>, and optimisation flags (CXXFLAGS) will be the same as those used when compiling the IT++ library.</p>
<p>When you need to use static linking, you might need to prepend the `–libs' switch with `–static', e.g.:</p>
<div class="fragment"><div class="line">% export CXXFLAGS=`itpp-config --cflags`</div>
<div class="line">% export LIBS=`itpp-config --<span class="keyword">static</span> --libs`</div>
<div class="line">% g++ $CXXFLAGS -o my_prog my_prog.cpp $LIBS</div>
</div><!-- fragment --><p>Moreover, if you compiled and installed the debugging IT++ library (<code>`libitpp_debug</code>.*') by using <code>`–enable-debug'</code> swich to configure, you can compile and link your program with debugging options using the following command instead:</p>
<div class="fragment"><div class="line">% g++ `itpp-config --debug --cflags` -o my_prog_debug my_prog.cpp `itpp-config --debug --libs`</div>
</div><!-- fragment --><p>Full list of <code>`itpp-config'</code> options can be obtained by typing:</p>
<div class="fragment"><div class="line">% itpp-config --help</div>
</div><!-- fragment --><p>If the <code>`itpp-config'</code> command is not found by your shell, you should add its location <code>`$prefix/bin'</code> to the PATH environment variable, e.g.:</p>
<div class="fragment"><div class="line">% export PATH=/usr/local/bin:$PATH</div>
</div><!-- fragment --><h1><a class="anchor" id="dynamiclinking"></a>
Using IT++ with dynamic linking</h1>
<p>When using static linking some of the IT++ library routines are copied into your executable program. This can lead to unnecessary large executables. To avoid this you may use dynamic linking instead. Dynamic linking means that the actual linking is performed when the program is executed. This requires that the system is able to locate the shared IT++ library file (<code>`libitpp.so'</code> or <code>`libittp_debug.so</code>) during the program execution. If you have to install the IT++ library using non-standard prefix, the <code>`LD_LIBRARY_PATH'</code> environment variable might be used to inform the linker about the location of the shared library object (<code>`$prefix/lib'</code>), e.g.:</p>
<div class="fragment"><div class="line">% export LD_LIBRARY_PATH=<span class="stringliteral">"/usr/local/lib:$LD_LIBRARY_PATH"</span></div>
</div><!-- fragment --><p>This environment variable can be also used to set dynamic linking library paths for external libraries which are used by IT++, e.g. ATLAS, MKL, ACML and others.</p>
<h1><a class="anchor" id="msvc_linking"></a>
Linking your own programs with IT++ using MSVC++</h1>
<p>It is assumed here that the IT++ library is already compiled and linked with either ACML or MKL, using Microsoft Visual C++ .NET (or Express) compiler (see <a class="el" href="installation.html#msvc">IT++ Compilation and Installation using Microsoft Visual C++</a>).</p>
<p>To link your own programs with IT++ and ACML or MKL, several things need to be correctly set up in your MSVC++ project:</p>
<ul>
<li>The IT++ include directory must be defined. Settings for this can be found in the <code>"Tools -&gt; Options -&gt; Projects and Solutions -&gt; VC++
Directories -&gt; Include files"</code> menu. Add path to <code>"<IT++ source directory>"</code>, e.g. <code>"C:\itpp-4.0.1"</code>.</li>
<li>The IT++ library directory must be defined. Settings for this can be found in the <code>"Tools -&gt; Options -&gt; Projects and Solutions -&gt; VC++
Directories -&gt; Library files"</code> menu. Add path to <code>"<IT++ source directory>\win32\lib"</code>, e.g. <code>"C:\itpp-4.0.1\win32\lib"</code>.</li>
<li>The ACML or MKL library directory must be defined. If you properly set up the <code>LIB</code> environment variable after the installation of ACML or MKL (see <a class="el" href="installation.html#msvc">IT++ Compilation and Installation using Microsoft Visual C++</a>), you can just add <code>$(LIB)</code> as an another library path.</li>
<li>Linking with IT++ and ACML or MKL must be set up. Do this by marking your project and go to the <code>"Project -&gt; Properties -&gt; Configuration
Properties -&gt; Linker -&gt; Input -&gt; Additional Dependencies"</code> menu. There you need to add <code>itpp_debug.lib</code> or <code>itpp.lib</code> depending on whether the Debug or Release mode are being used. Furthermore, you need to add <code>libacml_dll.lib</code> or <code>mkl_c_dll.lib</code>, respectively.</li>
<li>Two additional definitions: <code>_CRT_SECURE_NO_DEPRECATE</code> and <code>_CRT_NONSTDC_NO_DEPRECATE</code>, which disable warnings on Standard C Library and POSIX-compilant function names, might be also added in <code>"Project -&gt; Properties -&gt; Configuration Properties -&gt; C/C++
-&gt; Preprocessor -&gt; Preprocessor Definitions"</code>. Moreover, <code>HAVE_ACML</code> or <code>HAVE_MKL</code> definitions should be set up, depending on the installed library.</li>
</ul>
<p>Please note that similar project settings for your program must be made for both the Debug and Release modes.</p>
<h1><a class="anchor" id="matlab_load_and_save"></a>
Using IT++ file format in Matlab/Octave</h1>
<p>IT++ provides two m-files <code>`itload.m'</code> and <code>`itsave.m'</code>, which can be used for reading and writing IT++ data files in Matlab or GNU Octave. To ensure that Matlab/Octave finds these two files you should add the following directory <code>`$prefix/share/itpp'</code> to the default path in Matlab/Octave, e.g.:</p>
<div class="fragment"><div class="line">p = path; path(p, <span class="stringliteral">"/usr/local/share/itpp"</span>);</div>
</div><!-- fragment --><h1><a class="anchor" id="python_load"></a>
Using IT++ file format in Python</h1>
<p>IT++ provides a Python module <code>`pyitpp.py'</code> with <code>`itload()'</code> function for reading IT++ data files in Python. This module uses <code>`numpy'</code> module for matrix operations and extended numerical types support. Additionally, you might need <code>`matplotlib'</code> module in order to graphically display the loaded data. To ensure that Python finds this module, you should add the following directory <code>`$prefix/share/itpp'</code> to the Python search path, e.g.</p>
<div class="fragment"><div class="line"><span class="keyword">import</span> sys</div>
<div class="line">sys.path.append(<span class="stringliteral">'$prefix/share/itpp'</span>)</div>
<div class="line"><span class="keyword">import</span> pyitpp</div>
</div><!-- fragment --> </div></div><!-- contents -->
<div style="clear: both; width: 100%; height: 31px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=37044&type=1" alt="SourceForge Logo" style="float: right; border: 0;"></a>
<p style="padding-left: 10px; font-size: 85%;">Generated on Sat Mar 22 2014 05:34:27 for IT++ by <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.6</p>
</div>
</body>
</html>
|