Eclipse + AVR plugin + Arduino Lib (on linux)

Hi everyone,

I have setup my Eclipse using the following tutorial

Installation is successful and I can compile and upload the program given in example.

From now on I would like to use the Arduino libraries but I am not able to compile correctly.

For instance, the simple code:

#include <Arduino.h>
#include <LiquidCrystal.h>

#define LCD_LIGHT_PIN A4

LiquidCrystal lcd(12, 11, 5, 4, 1, 0);

void setup() {
  // put your setup code here, to run once:
  lcd.begin(16, 2);

  // Set the LCD display backlight pin as an output.

  // Turn the backlight on.
  digitalWrite(LCD_LIGHT_PIN, HIGH);

void loop() {
  // put your main code here, to run repeatedly:
  lcd.print("Hello World!");

is compiling and functionning correctly with the arduino ide

When using eclipse and adding the following includes to my project :


for both C/C++ Build > Settings > AVR Compiler > Directories and C/C++ Build > Settings > AVR C++ Compiler > Directories

I get the following errors when compiling:

10:57:53 **** Incremental Build of configuration Release for project Test4 ****
make all
Building file: …/Test.cpp
Invoking: AVR C++ Compiler
avr-g++ -I./arduino-1.6.11/hardware/arduino/avr/cores/arduino -I./arduino-1.6.11/libraries/LiquidCrystal/src -I./arduino-1.6.11/hardware/arduino/avr/variants/standard -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"Test.d" -MT"Test.o" -c -o “Test.o” “…/Test.cpp”
Finished building: …/Test.cpp

Building target: Test4.elf
Invoking: AVR C++ Linker
avr-g++ -Wl,-Map,,–cref -mrelax -Wl,–gc-sections -mmcu=atmega328p -o “Test4.elf” ./Test.o
/usr/lib/gcc/avr/4.9.2/…/…/…/avr/lib/avr5/crtatmega328p.o:(.init9+0x0) : undefined reference to « main »
./Test.o : in the functionn « _GLOBAL__sub_I_lcd » :
Test.cpp:(.text.startup._GLOBAL__sub_I_lcd+0x18) : undefined reference to « LiquidCrystal::LiquidCrystal(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char) »
collect2: error: ld returned 1 exit status
makefile:71 : the receipt fot target « Test4.elf » has failed
make: *** [Test4.elf] Erreur 1

10:57:53 Build Finished (took 200ms)

Do not know how to solve that.