user29544: I have a project that is part of a larger repository, and shares header files with non-Arduino C programs.
I know that it's possible to use these headers by copying them to the libraries folder, or the sketch folder, but I would rather use them with a relative path (which seems to not work), so I can avoid copying files around for every repository clone or update.
Is there a solution that doesn't involve moving/copying the header file?
EDIT:
Although there is no full solution for this question,
I have since found that using the PlatformIO 
IDE instead solves the problem.

user6936: I tried to do this, and looked into it, a few years ago, but it doesn't appear to be possible to do what you want to do. This guy was having the same issue, #include statement with relative path.
Seems like either Michel's suggestion or copying them (which is a pain) will work, from Can I include a header file that is not a library?:

If the include file is part of a single Sketch, instructions are
  here... http://www.arduino.cc/en/Hacking/BuildProcess [new
  link]
If the include file is meant to be shared by multiple Sketches then...

Close the Arduino IDE
Navigate to the {Arduino}\hardware\libraries directory
Create a subdirectory.  I suggest something like MyCommon.
In the new subdirectory, create a header file.  I suggest something like MyCommon.h.
Open the new header file, edit it as you wish, and save it
Open the Arduino IDE
Create or open a Sketch
Add a #include to the top of the Sketch that references your new include file



This is why relative paths are not supported, from Re: how to include header file from previous folder?

Enable verbose mode when compiling. Navigate to the Testing.cpp file that is created from the Testing .ino file. Go up one level. Do you see the files you are trying to include?

and from Re: how to include header file from previous folder? (emphasis is mine)

The reason for having you go look at the something
  like/AppData/Local/Temp/build/sketch folder was
  to make you think about what the build process is doing, and maybe
  think that you could google Arduino + Build to get more details.
The IDE copies your sketch, and stuff #included by your sketch to a
  build directory.
If you #include , the file header.h, and everything else in
  the directory it is in, will be copied to the build directory, too.
If you #include "header.h", the file header.h, and everything else in
  the directory it is in, will be copied to the build directory, too.
The difference between <> and "" is where the header.h file is looked
  for. "" looks in the current directory. <> looks in the library
  directories.
If the token between the <> or the "" is not found in the appropriate
  folder, you are not told that; nothing gets copied, though.
But, that explains why relative names are useless. A sketch directory
  might contain a file called header.h. It will not contain a file
  called ..\header.h, because ..\header is NOT a valid file name.
Note that I did NOT say that ..\header.h is not a valid NAME. I said
  that it is not a valid FILE NAME.
Only file names between the <> or "" are possible, as far as the IDE
  is concerned.
If you do not like that, you are free to not use the IDE.

Finally from Re: How to specify a path to a specific header file?

The Arduino system has some severe limitations in its ability to work sensibly with the file system - can be a real PITA.


user31105: You can use header files with an absolute name, like:
#include "c:\Temp\x.h"

Another way that might help is to make the include path like:
#include "q:\x.h"

And use Windows to map driver letter Q to the path you need.

29544: <p>I have a project that is part of a larger repository, and shares header files with non-Arduino C programs.</p>

<p>I know that it's possible to use these headers by copying them to the libraries folder, or the sketch folder, but I would rather use them with a relative path (which seems to not work), so I can avoid copying files around for every repository clone or update.</p>

<p>Is there a solution that doesn't involve moving/copying the header file?</p>

<p>EDIT:
Although there is no full solution for this question,
I have since found that using the <a href="https://platformio.org/" rel="nofollow noreferrer">PlatformIO</a> 
IDE instead solves the problem.</p>
 6936: <p>I tried to do this, and looked into it, a few years ago, but it doesn't appear to be possible to do what you want to do. This guy was having the same issue, <a href="https://forum.arduino.cc/index.php?topic=110950.0" rel="nofollow noreferrer">#include statement with relative path</a>.</p>

<p>Seems like either Michel's suggestion or copying them (which <em>is</em> a pain) will work, from <a href="http://forum.arduino.cc/index.php?topic=37371.msg276056#msg276056" rel="nofollow noreferrer">Can I include a header file that is not a library?</a>:</p>

<blockquote>
  <p>If the include file is part of a single Sketch, instructions are
  here... <a href="http://www.arduino.cc/en/Hacking/BuildProcess" rel="nofollow noreferrer">http://www.arduino.cc/en/Hacking/BuildProcess</a> [<a href="https://github.com/arduino/Arduino/wiki/Build-Process" rel="nofollow noreferrer">new
  link</a>]</p>
  
  <p>If the include file is meant to be shared by multiple Sketches then...</p>
  
  <ul>
  <li>Close the Arduino IDE</li>
  <li>Navigate to the <code>{Arduino}\hardware\libraries</code> directory</li>
  <li>Create a subdirectory.  I suggest something like <code>MyCommon</code>.</li>
  <li>In the new subdirectory, create a header file.  I suggest something like <code>MyCommon.h</code>.</li>
  <li>Open the new header file, edit it as you wish, and save it</li>
  <li>Open the Arduino IDE</li>
  <li>Create or open a Sketch</li>
  <li>Add a <code>#include</code> to the top of the Sketch that references your new include file</li>
  </ul>
</blockquote>

<hr>

<p>This is <strong><em>why</em></strong> relative paths are not supported, from <a href="https://forum.arduino.cc/index.php?topic=405797.msg2791119#msg2791119" rel="nofollow noreferrer">Re: how to include header file from previous folder?</a></p>

<blockquote>
  <p>Enable verbose mode when compiling. Navigate to the Testing.cpp file that is created from the Testing .ino file. Go up one level. Do you see the files you are trying to include?</p>
</blockquote>

<p>and from <a href="https://forum.arduino.cc/index.php?topic=405797.msg2792289#msg2792289" rel="nofollow noreferrer">Re: how to include header file from previous folder?</a> (emphasis is mine)</p>

<blockquote>
  <p>The reason for having you go look at the something
  like/AppData/Local/Temp/build/sketch folder was
  to make you think about what the build process is doing, and maybe
  think that you could google Arduino + Build to get more details.</p>
  
  <p>The IDE copies your sketch, and stuff #included by your sketch to a
  build directory.</p>
  
  <p>If you #include , the file header.h, and everything else in
  the directory it is in, will be copied to the build directory, too.</p>
  
  <p>If you #include "header.h", the file header.h, and everything else in
  the directory it is in, will be copied to the build directory, too.</p>
  
  <p>The difference between &lt;> and "" is where the header.h file is looked
  for. "" looks in the current directory. &lt;> looks in the library
  directories.</p>
  
  <p>If the token between the &lt;> or the "" is not found in the appropriate
  folder, you are not told that; nothing gets copied, though.</p>
  
  <p>But, <strong>that explains why relative names are useless</strong>. A sketch directory
  might contain a file called header.h. It will not contain a file
  called ..\header.h, because ..\header is NOT a valid file name.</p>
  
  <p>Note that I did NOT say that ..\header.h is not a valid NAME. I said
  that it is not a valid FILE NAME.</p>
  
  <p>Only file names between the &lt;> or "" are possible, as far as the IDE
  is concerned.</p>
  
  <p>If you do not like that, you are free to not use the IDE.</p>
</blockquote>

<p>Finally from <a href="https://forum.arduino.cc/index.php?topic=496614.msg3388572#msg3388572" rel="nofollow noreferrer">Re: How to specify a path to a specific header file?</a></p>

<blockquote>
  <p>The Arduino system has some severe limitations in its ability to work sensibly with the file system - can be a real PITA.</p>
</blockquote>
 31105: <p>You can use header files with an absolute name, like:</p>

<pre><code>#include "c:\Temp\x.h"
</code></pre>

<p>Another way that might help is to make the include path like:</p>

<pre><code>#include "q:\x.h"
</code></pre>

<p>And use Windows to map driver letter Q to the path you need.</p>
