Skip to main content
added 217 characters in body
Source Link
qwr
  • 165
  • 7

It is simplest to put only one .ino file in a directory with the filename. Why does an `.ino` file have to be in a folder of the same name?

Option 1 (cleanest option): Create a user library.

Option 2 (workaround): Relative paths for #include aren't supported but you can use a symlink to make it appear that there is the same header file in every directory:

sketch1/
  sketch1.ino
  mylib.h
sketch2/
  sketch2.ino
  mylib.h (this is a symlink to sketch1/mylib.h) 

Option 3: Avoid Arduino IDE entirely and build using avr-gcc. Example: http://thinkingonthinking.com/an-arduino-sketch-from-scratch/ and Will a .ino Arduino Sketch compile directly on GCC-AVR? This is much more complicated, but supports bigger projects using Makefiles.

It is simplest to put only one .ino file in a directory with the filename. Why does an `.ino` file have to be in a folder of the same name?

Option 1 (cleanest option): Create a user library.

Option 2 (workaround): Relative paths for #include aren't supported but you can use a symlink to make it appear that there is the same header file in every directory:

sketch1/
  sketch1.ino
  mylib.h
sketch2/
  sketch2.ino
  mylib.h (this is a symlink to sketch1/mylib.h) 

It is simplest to put only one .ino file in a directory with the filename. Why does an `.ino` file have to be in a folder of the same name?

Option 1 (cleanest option): Create a user library.

Option 2 (workaround): Relative paths for #include aren't supported but you can use a symlink to make it appear that there is the same header file in every directory:

sketch1/
  sketch1.ino
  mylib.h
sketch2/
  sketch2.ino
  mylib.h (this is a symlink to sketch1/mylib.h) 

Option 3: Avoid Arduino IDE entirely and build using avr-gcc. Example: http://thinkingonthinking.com/an-arduino-sketch-from-scratch/ and Will a .ino Arduino Sketch compile directly on GCC-AVR? This is much more complicated, but supports bigger projects using Makefiles.

Source Link
qwr
  • 165
  • 7

It is simplest to put only one .ino file in a directory with the filename. Why does an `.ino` file have to be in a folder of the same name?

Option 1 (cleanest option): Create a user library.

Option 2 (workaround): Relative paths for #include aren't supported but you can use a symlink to make it appear that there is the same header file in every directory:

sketch1/
  sketch1.ino
  mylib.h
sketch2/
  sketch2.ino
  mylib.h (this is a symlink to sketch1/mylib.h)