Hello,
I'm trying to make my own little lib with some function and classes, one of the class is basicly a serial writer (with some extra options). The problem is that in Eclipse (Yes everything is set up allright, I followed the tutorial correctly) Serial1 could not be resolved.
My code (this is the cpp file, headers are just basic stuff)
#include <WProgram.h>
#include "proxyLayer.h"
#include "serialConnect.h"
void PlayerClient::writeToSerial(int16_t data) {
Serial1.write(data);
}
If I compile it with eclipse it says It didnt find any errors and compiles just allright but then if I implement the library in another project it gives me following errors
**** Build of configuration Debug for project mainProject ****
make all
Building target: mainProject.elf
Invoking: AVR C++ Linker
avr-gcc --cref -s -Os -o"mainProject.elf" ./main.o -lMegaCore -lIrobotCore -lm -Wl,-Map,mainProject.map,--cref -Wl,--gc-sections -L/home/jan/eclipse/Arduino/IrobotCore -L/home/jan/eclipse/Arduino -mmcu=atmega2560
/home/jan/eclipse/Arduino/IrobotCore/libIrobotCore.a(serialConnect.o): In function `PlayerClient::drive(int, int)':
serialConnect.cpp:(.text._ZN12PlayerClient5driveEii+0x10): undefined reference to `Serial1'
serialConnect.cpp:(.text._ZN12PlayerClient5driveEii+0x12): undefined reference to `Serial1'
serialConnect.cpp:(.text._ZN12PlayerClient5driveEii+0x18): undefined reference to `HardwareSerial::write(unsigned char)'
serialConnect.cpp:(.text._ZN12PlayerClient5driveEii+0x20): undefined reference to `HardwareSerial::write(unsigned char)'
serialConnect.cpp:(.text._ZN12PlayerClient5driveEii+0x28): undefined reference to `HardwareSerial::write(unsigned char)'
serialConnect.cpp:(.text._ZN12PlayerClient5driveEii+0x30): undefined reference to `HardwareSerial::write(unsigned char)'
serialConnect.cpp:(.text._ZN12PlayerClient5driveEii+0x38): undefined reference to `HardwareSerial::write(unsigned char)'
/home/jan/eclipse/Arduino/IrobotCore/libIrobotCore.a(serialConnect.o): In function `PlayerClient::start()':
serialConnect.cpp:(.text._ZN12PlayerClient5startEv+0x6): undefined reference to `Serial1'
serialConnect.cpp:(.text._ZN12PlayerClient5startEv+0x8): undefined reference to `Serial1'
serialConnect.cpp:(.text._ZN12PlayerClient5startEv+0x14): undefined reference to `HardwareSerial::begin(long)'
serialConnect.cpp:(.text._ZN12PlayerClient5startEv+0x1c): undefined reference to `HardwareSerial::write(unsigned char)'
make: *** [mainProject.elf] Error 1
**** Build Finished ****
Sooo there is a problem I guess, the point is what? Could this be my IDE eclipse or just something else?
Thanks alot!