sirleech/Webduino

Split the library in two files .h and .cpp

Closed this issue · 2 comments

Hey sirleech,

for me i was not able to implement your library in my own library to use it there, until i found this post on the arduino forum: http://forum.arduino.cc/index.php?topic=120624.msg1006859#msg1006859

After i splitted your one .h file in an implementation and a header file everything compiled very well.
It would be no big deal to split the file and it would be really helpful if you could do so.

Kind Regards,
Max

When I originally wrote the library, I did it entirely as a header because it made it possible for a user to override options through #defines before they include the .h.

The code already supports this without needing to be split. Just have

#define WEBDUINO_NO_IMPLEMENTATION

in all of the files that include this other than the first. This will preprocess out all of the implementation code.

I don't understand your question. All the the P() strings used by the
library are only defined in the implementation part of the header. You
need one of your sources to not have the WEBDUINO_NO_IMPLEMENTATION
#define, without that you'd also not have the code implementation of the
library.

On Tue, Aug 19, 2014 at 2:18 PM, MaxBec notifications@github.com wrote:

Perfect. Thank you for you answer.

I still have another question. Is there any possibility to define the P in
the .ino file and to use it in my library.
Because if i do this i get the error that the P strings are not defined.

kind regards

Am 19.08.2014 um 21:11 schrieb Ben Combee notifications@github.com:

When I originally wrote the library, I did it entirely as a header
because it made it possible for a user to override options through #defines
before they include the .h.

The code already supports this without needing to be split. Just have

#define WEBDUINO_NO_IMPLEMENTATION
in all of the files that include this other than the first. This will
preprocess out all of the implementation code.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#58 (comment).