Go Down

Topic: Error while compiling library in MEGA 2560.  (Read 78 times) previous topic - next topic

ricardojlrufino

Hello friends.
I'm having a strange compilation error when using the Arduino MEGA. The error seems to occur in a declaration of an enum, but the curious thing is that almost all other boards (UNO, Leonardo, Yun, Explora, Nano) compilation works normally.

What's special about MEGA?

My LIB: https://github.com/OpenDevice/opendevice-lib-arduino

Error:

Code: [Select]

In file included from /media/ricardo/Dados/Programacao/arduino-1.6.7/hardware/tools/avr/avr/include/avr/io.h:99:0,
                 from /media/ricardo/Dados/Programacao/arduino-1.6.7/hardware/tools/avr/avr/include/avr/pgmspace.h:88,
                 from /media/ricardo/Dados/Programacao/arduino-1.6.7/hardware/arduino/avr/cores/arduino/Arduino.h:28,
                 from sketch/UsbConnection.ino.cpp:1:
/media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/src/Command.h:31:6: error: expected identifier before '(' token
      PING                    = 20,
      ^
/media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/src/Command.h:31:6: error: expected '}' before '(' token
/media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/src/Command.h:31:6: error: expected unqualified-id before 'volatile'
      PING                    = 20,
      ^
/media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/src/Command.h:31:6: error: expected ')' before 'volatile'
/media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/src/Command.h:31:6: error: expected ')' before 'volatile'
In file included from /media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/src/OpenDevice.h:20:0,
                 from /media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/examples/UsbConnection/UsbConnection.ino:7:
/media/ricardo/Dados/Codidos/Java/Projetos/OpenDevice/opendevice-hardware-libraries/arduino-sketchbook/libraries/OpenDevice/src/Command.h:58:1: error: expected declaration before '}' token
 }
 ^



ricardojlrufino

I found ....

The problem was just the MEGA 2560

It has a definition of such a PING,

Solution: Rename in my constant / enum .... all this ...

Arduino MEGA: arduino / avr / variants / mega / pins_arduino.h
Code: [Select]

uint16_t PROGMEM port_to_input_PGM const [] = {
NOT_A_PIN,
(uint16_t) & PINA,
(uint16_t) & PINB,
(uint16_t) & PINC,
(uint16_t) & PIND,
(uint16_t) & PINE,
(uint16_t) & PINF,
(uint16_t) & PING,
(uint16_t) & pinion,
NOT_A_PIN,
(uint16_t) & PINJ,
(uint16_t) & PINK,
(uint16_t) & pinl,
};


Generating a conflict with my constant PING. Now the strange thing is that it is set within a Namespace theoretically supposed to stay in another scope:
https://github.com/OpenDevice/opendevice-lib-arduino/blob/master/src/Command.h

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy