xukangmin / TinyCore

TinyCore boards / attiny 1 series Core, Arduino IDE Core, targets ATtiny 417 / 814 / 816 / 817 / 1614 / 1616 / 1617 / 3217 and similar MCUs
https://tinycore.dev
MIT License
37 stars 10 forks source link

Compile error: conflicting declaration 'typedef enum _BitOrder BitOrder' #4

Closed mysmartbus closed 3 years ago

mysmartbus commented 3 years ago

I'm getting a compile time error for the TinyCore 32 board.

Error:

Adafruit_SPIDevice.h:18:3: error: conflicting declaration 'typedef enum _BitOrder BitOrder' Common.h:27:3: note: previous declaration as 'typedef enum BitOrder BitOrder'

Full error message:

/home/<username>/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.h:18:3: error: conflicting declaration 'typedef enum _BitOrder BitOrder'
 } BitOrder;
   ^~~~~~~~

/home/<username>/.arduino15/packages/TinyCore/hardware/avr/0.0.6/cores/tiny/api/Common.h:27:3: note: previous declaration as 'typedef enum BitOrder BitOrder'
 } BitOrder;
   ^~~~~~~~

The next error message appears to be a result of the above error messages:

/home/<username>/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.h:62:43: error: could not convert 'SPI_BITORDER_MSBFIRST' from '_BitOrder' to 'BitOrder'
                      BitOrder dataOrder = SPI_BITORDER_MSBFIRST,
                                           ^~~~~~~~~~~~~~~~~~~~~

My project use's Adafruit's INA260 library.

Traceback:

/home/<username>/the_project/the_project.ino
    Line 15: #include <Adafruit_INA260.h>

/home/<username>/Arduino/libraries/Adafruit_INA260_Library/Adafruit_INA260.h
    Line 22: #include <Adafruit_I2CRegister.h>

/home/<username>/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CRegister.h
    Line 1: #include "Adafruit_BusIO_Register.h"

/home/<username>/Arduino/libraries/Adafruit_BusIO/Adafruit_BusIO_Register.h
    Line 2: #include <Adafruit_SPIDevice.h>

/home/<username>/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.h
    Line 15: typedef enum _BitOrder {
    Line 16:   SPI_BITORDER_MSBFIRST = MSBFIRST,
    Line 17:   SPI_BITORDER_LSBFIRST = LSBFIRST,
    Line 18: } BitOrder;

Version info: Arduino IDE: v1.8.13 (on Linux) TinyCore Boards: v0.0.6 (by Kangmin) Adafruit INA260 Library: v1.3.5 (by Adafruit)

The LED blinking code from https://tinycore.dev/ compiles successfully.

xukangmin commented 3 years ago

Please update TinyCore to 0.0.7 and try to compile again. I fixed above definition conflict issue.

mysmartbus commented 3 years ago

Updated to TinyCore 0.0.7 and I can now compile the program without errors.