Stop Watch problem

Currently I am working on developing a stop watch using StopWatch libraries. I faced few issues with my own code due to the compiling errors. i tried with one of the dummy programs available in the Arduino homepage.

Compiling the same code available in the web page gives me this error:

Please let me know what is the reason for this error. Thanks in advance

I had placed the StopWatch.h and .cpp files in the libraries folder. i copied these library files from the webpage
"Arduino Playground - Stopwatch"

#####################################################################

sketch_dec28a.cpp.o: In function __static_initialization_and_destruction_0': C:\Program Files\Arduino/sketch_dec28a.ino:6: undefined reference to StopWatch::StopWatch(StopWatch::Resolution)'
C:\Program Files\Arduino/sketch_dec28a.ino:7: undefined reference to StopWatch::StopWatch(StopWatch::Resolution)' C:\Program Files\Arduino/sketch_dec28a.ino:8: undefined reference to StopWatch::StopWatch(StopWatch::Resolution)'
sketch_dec28a.cpp.o: In function StopWatch::elapsed()': C:\Users\user\Documents\Arduino\libraries\StopWatch/StopWatch.h:28: undefined reference to StopWatch::value()'
C:\Users\user\Documents\Arduino\libraries\StopWatch/StopWatch.h:28: undefined reference to StopWatch::value()' C:\Users\user\Documents\Arduino\libraries\StopWatch/StopWatch.h:28: undefined reference to StopWatch::value()'
C:\Users\user\Documents\Arduino\libraries\StopWatch/StopWatch.h:28: undefined reference to StopWatch::value()' C:\Users\user\Documents\Arduino\libraries\StopWatch/StopWatch.h:28: undefined reference to StopWatch::value()'
sketch_dec28a.cpp.o:C:\Users\user\Documents\Arduino\libraries\StopWatch/StopWatch.h:28: more undefined references to StopWatch::value()' follow sketch_dec28a.cpp.o: In function setup':
C:\Program Files\Arduino/sketch_dec28a.ino:13: undefined reference to StopWatch::start()' C:\Program Files\Arduino/sketch_dec28a.ino:14: undefined reference to StopWatch::start()'
C:\Program Files\Arduino/sketch_dec28a.ino:15: undefined reference to `StopWatch::start()

I tried the code in the page that you refer and is working.
What are the files .cpp and .h that you refer?

I had placed the StopWatch.h and .cpp files in the libraries folder. i copied these library files from the webpage

This sketch don't need any library.

I had attached the .h and .cpp files and also the program. All these i copied from the link
"Arduino Playground - Stopwatch".

I was still have no idea why this isnt working?

sketch_dec28a.ino (823 Bytes)

StopWatch.cpp (1.75 KB)

StopWatch.h (1.05 KB)

Now I see your problem. We are using different "StopWatches" sketches.
For that version do the following:
inside the folder libraries (this folder is inside your skechbook folder) create a new folder and name it "StopWatch"
copy the files StopWatch.cpp and StopWatch.h to this folder
if you have the Arduino IDE opened, restart it (close all the windows and open it again)
open your sketch "sketch_dec28a.ino" and compile.

It should work. If you have problems take a look to this page.

It worked...Thanks a lot .... :slight_smile: