My question is very simple:
Is there any environment variable I can use to include a configuration file, coming from the sketch folder, in a library.
I have developped a library for communication but want to customize it for each appli, using some #define
I would like to include in my library such line: #include "APP/Conf.h"
with APP pointing on the folder where the .ino file is
unfortunately I fear it is not possible to include variables inside an #include statement in c/c++ language
You should/could use a preprocessor to do that, but unfortunately there are no preprocessor available in arduino env, as far as I know.
Robtillart: if the configuration file is in the library folder, it's OK. I can compile and run the application
but if the configuration file is in the sketch folder, following message is displayed:
"D:\arduino-1.0\libraries\MasterSlaveLib\MasterSlaveLib.cpp:34:29: error: MasterSlaveLib_Conf.h: No such file or directory"
My goal is to minimize the code generated regarding sketch configuration (e.g. application shall support all or some Master or Slave or both Master and Slave functions) that's why I need to have some #define.
To solve my problem, II know I can duplicate the library source files in all sketch folders and it will be OK but I loose the advantage to have only one source for all my projects.
I can also split my library to several part but maintenance will become very difficult.
I've unsuccessfuly tried this a lot and every time got an "undefined reference to" the function between #ifdef and #endif.
The only way for the #define to be taken into account by the lib seems to have it in the lib.cpp file itself or in a .h file included in the library.
I've done it a lot of time with other dev environments and was puzzled to fail with Arduino