/usr/share/qt5/doc/qtdoc/third-party-libraries.html is in qt5-doc-html 5.9.5-0ubuntu1.
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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- third-party-libraries.qdoc -->
<title>Third Party Libraries | Qt 5.9</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td ><a href="index.html">Qt 5.9</a></td><td >Third Party Libraries</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#source-code">Source Code</a></li>
<li class="level1"><a href="#library-files">Library Files</a></li>
<li class="level1"><a href="#destination-directory">Destination Directory</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Third Party Libraries</h1>
<span class="subtitle"></span>
<!-- $$$third-party-libraries.html-description -->
<div class="descr"> <a name="details"></a>
<p>Using a third-party library with Qt is a simple process. Suppose you know of a cross-platform library that accepts audio samples of a cat's meows and translates them into English words. This library is named <code>CatWhisperer</code>, and has several files that it provides as part of its library. Your project, <code>MyQtApp</code>, stores these files in a folder named <code>3rdparty</code>:</p>
<ul>
<li>MyQtApp/<ul>
<li>MyQtApp.pro</li>
<li>src/<ul>
<li>main.cpp</li>
</ul>
</li>
<li>3rdparty/<ul>
<li>CatWhisperer<ul>
<li>include/<ul>
<li>CatWhisperer.h</li>
</ul>
</li>
<li>lib/<ul>
<li>libCatWhisperer.so</li>
<li>CatWhisperer.lib</li>
</ul>
</li>
<li>bin/<ul>
<li>CatWhisperer.dll</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>To use the <code>CatWhisperer</code> library in <code>MyQtApp</code>, <code>qmake</code> requires the location and names of the <code>CatWhisperer</code> libraries. Optionally, you can also:</p>
<ul>
<li>Provide the location of the <code>CatWhisperer</code> source code so that you don't have to type out the full path to each file when you include them in your own code.</li>
<li>Choose the destination in which the <code>MyQtApp</code> executable will be created.</li>
</ul>
<p>The information above is provided in the <code>.pro</code> file, so that <code>qmake</code> can parse it and produce makefiles. Makefiles contain all the information needed by your compiler and linker to produce output, whether it is an executable, another library file, etc. The next sections explain the syntax with which <code>qmake</code> expects you to provide this information.</p>
<a name="source-code"></a>
<h2 id="source-code">Source Code</h2>
<p>To be able to write</p>
<pre class="cpp">
<span class="preprocessor">#include <CatWhisperer.h></span>
</pre>
<p>instead of</p>
<pre class="cpp">
<span class="preprocessor">#include <3rdparty/CatWhisperer/include/CatWhisperer.h></span>
</pre>
<p>you can provide the path to the <code>CatWhisperer</code> <code>include</code> directory, using the <a href="../qmake/qmake-variable-reference.html#includepath">INCLUDEPATH</a> variable:</p>
<pre class="cpp">
INCLUDEPATH <span class="operator">+</span><span class="operator">=</span> <span class="number">3rdparty</span><span class="operator">/</span>CatWhisperer<span class="operator">/</span><span class="keyword">include</span>
</pre>
<a name="library-files"></a>
<h2 id="library-files">Library Files</h2>
<p>To let <code>qmake</code> know where to find the <code>CatWhisperer</code> library files, use the <a href="../qmake/qmake-variable-reference.html#libs">LIBS</a> variable:</p>
<pre class="cpp">
LIBS <span class="operator">+</span><span class="operator">=</span> <span class="operator">-</span>L<span class="string">"3rdparty/CatWhisperer/lib"</span> <span class="operator">-</span>lCatWhisperer
</pre>
<p>The first part of the expression lets the linker know in which directory it should look for the library files. The double quotes are only necessary when the path contains spaces, so we could have omitted them in this example.</p>
<p>The second part tells the linker which libraries to link against. We have two different library files for UNIX platforms and Windows, respectively: <code>libCatWhisperer.so</code> and <code>CatWhisperer.lib</code>. It is not necessary to specify the <code>.lib</code> extension, nor the <code>lib</code> prefix (on UNIX platforms).</p>
<a name="destination-directory"></a>
<h2 id="destination-directory">Destination Directory</h2>
<p>By default, <code>qmake</code> creates the executable in the same directory as the <code>.pro</code> file. We can choose our own directory using the <a href="../qmake/qmake-variable-reference.html#destdir">DESTDIR</a> variable:</p>
<pre class="cpp">
DESTDIR <span class="operator">=</span> bin
</pre>
<p>That's it! You can now use the <code>CatWhisperer</code> library in your project. The final <code>.pro</code> file looks like this:</p>
<pre class="cpp">
TARGET <span class="operator">=</span> MyQtApp
TEMPLATE <span class="operator">=</span> app
INCLUDEPATH <span class="operator">+</span><span class="operator">=</span> <span class="number">3rdparty</span><span class="operator">/</span>CatWhisperer<span class="operator">/</span><span class="keyword">include</span>
SOURCES <span class="operator">+</span><span class="operator">=</span> src<span class="operator">/</span>main<span class="operator">.</span>cpp
LIBS <span class="operator">+</span><span class="operator">=</span> <span class="operator">-</span>L<span class="string">"3rdparty/CatWhisperer/lib"</span> <span class="operator">-</span>lCatWhisperer
</pre>
</div>
<p><b>See also </b><a href="../qmake/qmake-manual.html">qmake Manual</a> and <a href="http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html">Qt Creator: Adding Libraries to Projects</a>.</p>
<!-- @@@third-party-libraries.html -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|