<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Help OF with (adding ) &quot;include&quot; path ....]]></title><description><![CDATA[<p dir="auto">Could somebody nice tell me HOW TO ADD  #INCLUDE   WHEN IT IS not IN SAME pew / directory?</p>
<p dir="auto">Here is an example - I need to add #include to class file in project TEST_MAIN   and  add  a path to get to the project btscanner.</p>
<p dir="auto">I know  how to use "..."  but I have NEVER fully understood  how it works. So I am asking for advise how to ADD path to "include" . preferably using intelisense. ( Let the intelisense guide me... ) or just drag the path - from where...</p>
<p dir="auto">I sort of understand  how it works, but looking for easy way to implement / add the path.</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/128ef653-cf96-4fb9-b15c-38aceff8f3fb.png" alt="785b8fea-f57a-4ae9-bdf9-bf04fa64940d-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/142105/help-of-with-adding-include-path</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 14:22:21 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/142105.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Jan 2023 19:42:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help OF with (adding ) &quot;include&quot; path .... on Thu, 12 Jan 2023 19:27:27 GMT]]></title><description><![CDATA[<p dir="auto"><code>..</code> is just a part of a path meaning "one folder up". So you build your path just as you would "click it" in file explorer.<br />
Lets say you have a file structure like this:</p>
<pre><code class="language-txt">top
   project1
      something
         header.h
   project2
      something
         file.cpp
</code></pre>
<p dir="auto">and you want to include header1 in file.cpp. When starting from file.cpp location in a file explorer you would go two directories up and then two directories down to header.h.</p>
<p dir="auto">It's the same when constructing an include path. You start where the file you are in is. You go up twice and then down twice to the header, so:</p>
<pre><code>#include "../../project1/something/header.h"
</code></pre>
<p dir="auto">start in <code>top/project2/something/</code> because that's where file.cpp is<br />
first <code>..</code> takes you one up to <code>top/project2/</code><br />
second <code>..</code> takes you up to <code>top/</code><br />
and then <code>project1/something/</code> takes you to the header.</p>
<p dir="auto">But as <a class="plugin-mentions-user plugin-mentions-a" href="/user/fcarney">@<bdi>fcarney</bdi></a> said that's not a good idea because you're hardcoding in your source a path to another project. That's not something you should do. What you should do is add a base path to the other project to your INCLUDEPATH variable and then you can make includes relative to that. So in the above example you would add path to project1 in project2 like this: <code>INCLUDEPATH += ../project1</code> and then you could make a clean include like this in your file.cpp: <code>#include "something/header.h"</code>.</p>
]]></description><link>https://forum.qt.io/post/743642</link><guid isPermaLink="true">https://forum.qt.io/post/743642</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Thu, 12 Jan 2023 19:27:27 GMT</pubDate></item><item><title><![CDATA[Reply to Help OF with (adding ) &quot;include&quot; path .... on Thu, 12 Jan 2023 17:42:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fcarney">@<bdi>fcarney</bdi></a> Good idea , but<br />
it really does not answer my inquiry about  the usage  of   ".../"  - got a good reply in another forum...<br />
would be OK if I needed multiple access to same path   - do not need that feature<br />
would defeat the philosophy  to keep related stuff physically together<br />
Thanks<br />
Cheers</p>
]]></description><link>https://forum.qt.io/post/743634</link><guid isPermaLink="true">https://forum.qt.io/post/743634</guid><dc:creator><![CDATA[Anonymous_Banned275]]></dc:creator><pubDate>Thu, 12 Jan 2023 17:42:12 GMT</pubDate></item><item><title><![CDATA[Reply to Help OF with (adding ) &quot;include&quot; path .... on Wed, 11 Jan 2023 21:46:13 GMT]]></title><description><![CDATA[<p dir="auto">Do it in your pro file:</p>
<pre><code>INCLUDEPATH += ../somedir
</code></pre>
<p dir="auto">Then in cpp/h file:</p>
<pre><code>#include "file.h"
</code></pre>
]]></description><link>https://forum.qt.io/post/743525</link><guid isPermaLink="true">https://forum.qt.io/post/743525</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Wed, 11 Jan 2023 21:46:13 GMT</pubDate></item></channel></rss>