I am trying to program a very simple library to control an mBot robot through the Arduino IDE. To test the inclusion of the main Makeblock library, I created two files: mBotTest.h and mBotTest.cpp. The header file contains these lines of code:
#ifndef mBotTest_h
#define mBotTest_h
#include "MeMCore.h"
#endif /* mBotTest_h */
MeMCore.h is the general updated library for any Makeblock project.
In my cpp file, I only have the line: #include "mBotTest.h"
When I compile an Arduino sketch with the following code:
#include <mBotTest.h>
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
I get this error:
/var/folders/tm/g2z9fjsj0zb6sy27v7f6p3040000gn/T/arduino_build_416875/libraries/mBotTester/mBotTest.cpp.o (symbol from plugin): In function `mePort':
(.text+0x0): multiple definition of `mePort'
/var/folders/tm/g2z9fjsj0zb6sy27v7f6p3040000gn/T/arduino_build_416875/sketch/fuckoff.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
Of course I am not touching the function mePort (of the MeMCore.h library) at all although the error is clearly related to it. What could be happening? How could I fix this?
Thank you in advance.