2

can Arduino IDE point to a file in another directory? If yes how? With my code

../../main.h

the compile fails.

Error:

In file included from D:\Eigene Dateien\Entwicklung\SIGNALDuino_MR\src\arduino-ide\SIGNALDuino\SIGNALDuino.ino:1:0:

main.h:1:1: error: expected unqualified-id before '.' token

 ../../main.h

 ^

exit status 1
expected unqualified-id before '.' token

--------------- structure ------------------

TEST
  |--main.h
  |-----Ordner 1
             |-----Ordner 3
                       |--files.h
  |-----Ordner 2
             |-----Ordner 4
  • `#include "../../main.h"` – Juraj Feb 12 '20 at 12:44
  • 1
    No it doesn't work. The file exists in the directory (2 times back in the structure) :-( `#include "../../main.h" ^ compilation terminated. exit status 1 ../../main.h: No such file or directory` – user11528497 Feb 12 '20 at 13:02
  • I didn't expect it to work. the Arduino IDE builds the sketch in a temporary folder, not in the sketch folder. but to include the #iinclude directive is the only possible syntax – Juraj Feb 12 '20 at 13:09
  • 1
    But he should read the file from there :-( No absolute position should be given. The file is 2 levels up. – user11528497 Feb 12 '20 at 13:14
  • it is not two levels up from the temporary folder – Juraj Feb 12 '20 at 13:15
  • 1
    to avoid misunderstandings, it is a path \ src \ which has the first main.h. This contains the structure \ arduino-ide \ project \ where the main.h file is located. This should call the "first" main.h. – user11528497 Feb 12 '20 at 13:32
  • 1
    The answer is in the wrong direction. The user wants from MCUa.ino in TimerLib.h. But my plan is backwards. Jump back directories. Based on the example, from TimerLib.h to MCUa.ino – user11528497 Feb 12 '20 at 15:06
  • it is the same question as yours. include in sketch something on relative path – Juraj Feb 12 '20 at 15:10
  • it does not work `#include ../../main.h` or `#include "../../main.h"` – user11528497 Feb 12 '20 at 15:14
  • 1
    read the answer to the other question. – Juraj Feb 12 '20 at 15:15

0 Answers0