I have a sketch that compiles without errors.
If I turn it into a library, I get following errors:
D:\Arduino\libraries\DCF77\DCF77.cpp: In member function 'void DCF77::Stop()':
D:\Arduino\libraries\DCF77\DCF77.cpp:94: error: 'MsTimer2' has not been declared
D:\Arduino\libraries\DCF77\DCF77.cpp: In static member function 'static void DCF77::setTimer(int)':
D:\Arduino\libraries\DCF77\DCF77.cpp:223: error: 'MsTimer2' has not been declared
D:\Arduino\libraries\DCF77\DCF77.cpp:224: error: 'MsTimer2' has not been declared
D:\Arduino\libraries\DCF77\DCF77.cpp:225: error: 'MsTimer2' has not been declared
What am I doing wrong?
Below the concerning code from DCF77.cpp:
Set the timer to mSeconds and set the ISR
*/
inline void DCF77::setTimer(int mSeconds) {
MsTimer2::stop();
MsTimer2::set(mSeconds, processSignal);
MsTimer2::start();
}
OK. The problem is that the sketch doesn't include the MsTimer2 header file. So, the header file is not copied to the build directory, so the DCF77 source file can't include it. So, when compiling DCF77, MsTimer2 IS undefined.
You can't hide the use of a library. That's simply not allowed.
PaulS:
OK. The problem is that the sketch doesn't include the MsTimer2 header file. So, the header file is not copied to the build directory, so the DCF77 source file can't include it. So, when compiling DCF77, MsTimer2 IS undefined.
You can't hide the use of a library. That's simply not allowed.
?? I do not understand. looks like MsTimer2 header file was included just above the first comment
?? I do not understand. looks like MsTimer2 header file was included just above the first comment
That is above the first comment in the library source file. That is not the sketch you are looking at. That was added as an attachment later, and does NOT include the MsTimer2 header.