Anthony Limon
Anthony Limon

Reputation: 1

How should I go about fixing conflicting declarations of a function?

I am currently trying to get EVAL-CN0391-ARDZ Shield for Arduino UNO to work on the Arduino DUE. However, when installing and implementing the necessary files from the product's respective webpage, I had one error upon building. The error is on the SPI_Write() and SPI_Read() functions.

The shortened error message reads: conflicting declaration of C function 'void SPI_Write(unsigned char, unsigned char*, unsigned char)'

The longer error message (just one part):

In file included from src\All CPP Files\AD7124.cpp:50:0:
include/Communication.h:62:6: error: conflicting declaration of C function 'void SPI_Read(unsigned     char, unsigned char*, unsigned char)'
  void SPI_Read(unsigned char slaveDeviceId, unsigned char* data, unsigned char bytesNumber);
  ^~~~~~~~
In file included from C:\Users\Anthony.limon\.platformio\packages\framework-arduino-    sam\system\libsam/chip.h:58:0,
                 from C:\Users\Anthony.limon\.platformio\packages\framework-arduino-    sam\cores\arduino/Arduino.h:42,
                 from C:\Users\Anthony.limon\.platformio\packages\framework-arduino-    sam\variants\arduino_due_x/variant.h:25,
                 from C:\Users\Anthony.limon\.platformio\packages\framework-arduino-    sam\libraries\SPI\src/SPI.h:15,
                 from include/Communication.h:40,
                 from src\All CPP Files\AD7124.cpp:50:
C:\Users\Anthony.limon\.platformio\packages\framework-arduino-sam\system\libsam/include/spi.h:92:17:     note: previous declaration 'uint32_t SPI_Read(Spi*)'
 extern uint32_t SPI_Read( Spi* spi ) ;
             ^~~~~~~~
*** [.pio\build\due\src\All CPP Files\CN0391.cpp.o] Error 1
*** [.pio\build\due\src\All CPP Files\AD7124.cpp.o] Error 1
*** [.pio\build\due\src\All CPP Files\Communication.cpp.o] Error 1
*** [.pio\build\due\src\main.cpp.o] Error 1

I am new to these types of problems and am not very experienced. That being said, I haven't tried much but try to follow along other people having similar issues on the web. This method has not been very helpful as I am not sure to what even look up besides the error message which has not been very helpful.

Upvotes: 0

Views: 700

Answers (0)

Related Questions