Problems crating custom library

I've just crated the files Lib.h and Lib.cpp in my library folder.

i have included the following files in my library files (according to the library tutorial):

Lib.h:

#include "WConstants.h"

Lib.cpp.

#include "WProgram.h"
#include "Lib.h"

just by including the library in my sketch i get this error when compiling.

c:/documents and settings/administrator/my documents/downloads/arduino-0015-win/arduino-0015/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'


In file included from C:\Documents and Settings\Administrator\My Documents\Downloads\arduino-0015-win\arduino-0015\hardware\cores\arduino/WProgram.h:6,

any solution to this?

Change #include "WConstants.h" in .h to #include "WConstants.h"

And remove #include "WConstants.h" from .cpp

Delete the .o and recompile.

[edit]I've written about this here: http://www.arduino.cc/playground/Code/Library#Debugging (although still too short)[/edit]

you mean change #include “WConstants.h” to #include “WProgram.h” in .h?

And remove #include “Wprogram.h” from .cpp?

Lib.h

#include <WProgram.h>

Lib.cpp

#include "Lib.h"

:slight_smile: