Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Has anyone got the Arduino Leonardo to program in Eclipse?

I have no trouble with the UNO, but it seems the VID and PID settings are missing for the ATmega32u4

../src/USBCore.cpp:78:2: error: ‘USB_VID’ was not declared in this scope
../src/USBCore.cpp:78:2: error: ‘USB_PID’ was not declared in this scope

Googleing around has uncovered a few GIT projects talking about custom make files from the command prompt there there have recently (in the last month) worked out that they need special patches specifically for the Leonardo. All my projects are in Eclipse already, so it would be good to know how to fix this here.

Perhaps there is a simple #define i can just put somewhere?

[edit] I'm on Ubuntu b.t.w. (in an attempt to avoid a big discussion about windows drivers : P)

share|improve this question

Ok, so I have worked out that you can add USB_VID and USB_PID to

Project Properties -> C/C++ General -> Paths and Symbols -> Symbols -> Add

If you have multiple configurations its best to do it as your specific one for Leonardo.

If found in the ./hardware/arduino/bootloaders/caterina/Makefile that the values are as follows:

# USB vendor ID (VID)
# official Arduino LLC VID
# VID = 0x2341

# USB product ID (PID)
# official Leonardo PID
# PID = 0x0036

Ill leave the question as is, so others can find it. Because:

This then yeilds to the next errors for RXLED1, RXLED0, TXLED1, TXLED0 These are found in the pins_arduino.h file under variants. But when i add this lib to my Arduino core project, it is a problem since the default version of this file is read first.

The simple way to fix this is to add the second pins_arduino.h file into another folder and then add this to the start of the default one:

#ifdef USB_VID
#include "leonardo/pins_arduino.h"
## <the rest of the file goes here>

You also need to set like this for your specific build configuration so it pre-processor knows what you are doing.

This at least gets you to a compile. I don't really know how well it works in the end.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.