Library Examples with config files. (Linking issues)

Hi.

I am trying to turn a non-arduino application into an Arduino Library.

It has the following structure:

  • main.ino
    config.h
    utils.h
    utils.cpp

It works fine if all of it is in the same folder.

As soon as I create a library with the utils.h/cpp and add an example folder with the main.ino and config.h it returns the following error:

In file included from main.ino:30:
C:\arduino-1.0.3\libraries\test/utils.h:28:20: error: config.h: No such file or directory

How would I get around this?

The reason I have the config in the example folder is because I want to create one example for each Arduino Board with config specific to that board.

As you've discovered, what you are trying to do doesn't work.

You can...

• Modify the Arduino IDE so the sketch folder is added to the include path (and many folks would be grateful)

• Modify your library so configuration parameters are passed to an initialization function / method.

Do you have a link to the Arduino IDE code? I would not mind taking it apart... The IDE is just a simple wrapper so it might not be that hard.

Your second option sounds a lot like dependency injection where you need to inject all your data/settings/object into the constructor/Initializing function. (That will be a lot of work cause I have hundreds of settings.)

thinking of it, I could use a define statement that specifies the board type and configures the config file based on that. Might be the best option as the user starting out with the library will then not see the hundreds of settings and get confused by it.

Protoneer:
Do you have a link to the Arduino IDE code?

thinking of it, I could use a define statement that specifies the board type and configures the config file based on that. Might be the best option as the user starting out with the library will then not see the hundreds of settings and get confused by it.

I suspect your potential users would appreciate that.

Thanks for that... 8)