Include file location

I'm using IDE v1.0 on Windows 7 and I'm trying to include a header file that is not specific to a library. I use this for configuration data (IP Address, Modbus ID, analog mapping values, etc.). When ever I try to compile the sketch, I get an error about not finding the .h file. Where exactly should these (non-library specific) files go?

Thanks in advance!


Put it in your sketch directory. If you need it in more than a single sketch you have to make it a library.

What does it mean to "make it a library" exactly? I have about 10 different header (.h) files and I change my sketch to include the particular one I'm compiling but there is no "code" in any of them (mostly #defines) so I don't know what I'd have to put in the .cpp file to make it a library.

Is there no way I can specify where to look for files like this? If I put all of them in my sketch folder, can I just include the one I want or will it include ALL of the files in the sketch folder?


"Making it a library" simply means putting it in its own directory the libraries directory. You don't need to use a .cpp file; that's a convention, not a requirement.

Does this mean that I'll need a folder for each of my include files?

Only if you want to use the Sketch >> Import Library... properly. If you don't use it, it's not necessary.

You could store all you settings in one 'library' and then include only what you need. You have to make it a library because of the way Arduino handles paths - that's why you have to include all used libraries in the sketch even when you don't use them directly in the sketch but in another file included in the sketch.

You could make a library called MyLibrary located in a subdirectory named MyLibrary (in the user libraries path) containing all your header files. Importing this library includes all header files in the sketch making them usable in other files, too. Just remove the not needed from the sketch.