0

I am working on a project to use Arduino heart rate pulse wirelessly. My issue is when I add the RadioHead library to the existing generic heart pulse code; it is conflicting.

To be precise, it is conflicting with the interrupt section only. I read a bit on the Internet, and I guess I have a library conflict... But there aren't any other libraries in use.

When I try upload the sketch only after adding RadioHead:

#include <RH_ASK.h>

I get the following message:

C:\Users\namee\AppData\Local\Temp\cc9lzNai.ltrans2.ltrans.o: In function `main':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino Leonardo.
dda
  • 6,030
  • 2
  • 25
  • 34

1 Answers1

0

The cause of the error, as was already explained to you by sterretje in your cross post of this question to the Arduino Forum:

You simply did not write a setup() function in your sketch; nothing to do with a library conflict.

The Arduino convention is that every sketch should have a setup() and loop() function, even if they are left empty. In the Arduino core library there is a main() definition that calls these functions, thus the error you encountered when you didn't define setup() in your sketch. I find this to be a reasonable approach to making programming as beginner friendly as possible and it's useful for just about every project I've done. If for some reason you miss the standard main() of C++ then you can define your own main() in the sketch, where it will override the definition in main.cpp. However, I would recommend against doing that unless you have good reason.

per1234
  • 878
  • 5
  • 13
  • many thanks for your answer... actually this is not the main code I use it is like a sub tap (my mistake didnt declare this), however in Arduino form there was some help and they figured out that the issue is RadioHead is using timer 1 and 2 and that is why it is conflict ... the solution is by change RadioHead timer to 5 for instance so it will not interfere .. I didn't manage to edit the (RH_ASK.cpp) file to switch the timer but still working on it ... if you got any idea about this please write it to me .. thanks – Nameer Sahib Sep 23 '17 at 23:41
  • The error caused by the timer conflict is completely different from the error in this question and thus discussion of it is off topic here. It looks like that issue is well on its way to being resolved on the Arduino forum thread. – per1234 Sep 24 '17 at 00:01