Ardunio IDE output saying there is a library is there that does not exist

I recently got a pico W and have tried to upload code from Ardunio IDE, the output when trying to either verify and or upload is the following. The issue only happens when selecting the board as a raspberry Pico W while the Uno I also use doesn’t not encounter the same problem

Here is the error messages I receive. Please help if possible and thank you in advance for help

-R_DJ

Users/___/Documents/Arduino/libraries/MFRC522/src/MFRC522Extended.cpp: In member function ‘MFRC522::StatusCode MFRC522Extended::TCL_Transceive(TagInfo*, byte*, byte, byte*, byte*)’:
/Users//Documents/Arduino/libraries/MFRC522/src/MFRC522Extended.cpp:824:34: error: ordered comparison of pointer with integer zero (‘byte*’ {aka ‘unsigned char*’} and ‘int’)
824 | if (backData && (backLen > 0)) {
| ~~~~~~^
/Users/
/Documents/Arduino/libraries/MFRC522/src/MFRC522Extended.cpp:847:42: error: ordered comparison of pointer with integer zero (‘byte*’ {aka ‘unsigned char*’} and ‘int’)
847 | if (backData && (backLen > 0)) {
| ~~~~~~^
Multiple libraries were found for “SD.h”
Used: /Users/
/Library/Arduino15/packages/rp2040/hardware/rp2040/3.7.2/libraries/SD
Not used: /Users/_______r/Library/Arduino15/libraries/SD
exit status 1

Compilation error: exit status 1

3 Likes

Hi Nick,

Welcome back!

It looks like this is actually an error within one of the libraries themselves, the datatype on line 847 has been incorrecly defined according to the compiler
f (backData && (backLen > 0)) {

The error about the SD libraries are only a warning so compilation can continue behind the scenes.

To help more would it be possible to share a link to your library?

1 Like

Hi Liam,

So I have not installed any additional libraries as shown in the screen shot the only SD lib there is the one that comes pre loaded with the Ardunio IDE

2 Likes

Hi Nick,

The file MFRC522 is the one causing the error, would it be possible to send through your full code?

Are you running the same .ino file for the Uno and Pico?

1 Like

Why’s the MFRC522 causing the error? Since the SD is saying there is a duplicate lib.

I am also running the same .ino file

1 Like

The duplicate library can be ignored, unless for some reason you know that the one being used is wrong and you should be using the other.
*****/Users/*****/Library/Arduino15/packages/rp2040/hardware/rp2040/3.7.2/libraries/SD
was used.
*****/Users/******/Library/Arduino15/libraries/SD
was not used.

That duplicate library warning commonly occurs where a library for a particular processor is required instead of the generic library.

But the library where the error occurs is the RFID library. The file is
******/Users/*****/Documents/Arduino/libraries/MFRC522/src/MFRC522Extended.cpp

2 Likes

Firstly @Jeff105671 for the explanation
What is the issue with the RFID lib then?

The RFID lib causes no problems with the UNO so I am unsure

1 Like

Hi Nick,

Inside the MFRC library there is apparently a type conflict

Users/___/Documents/Arduino/libraries/MFRC522/src/MFRC522Extended.cpp: In member function ‘MFRC522::StatusCode MFRC522Extended::TCL_Transceive(TagInfo*, byte*, byte, byte*, byte*)’:
/Users//Documents/Arduino/libraries/MFRC522/src/MFRC522Extended.cpp:824:34: 

error: ordered comparison of pointer with integer zero (‘byte*’ {aka ‘unsigned char*’} and ‘int’)
824 | if (backData && (backLen > 0)) {

Without seeing your full code its hard to say what is causing it - would it be possible to send that through?
Liam

Hi Liam,
Thanks for the help
I’ll have a crack tonight and see how I go with troubleshooting this issue with this guidance if it doesn’t work I’ll send in the RFID extract from my code

  • Nick

It is quite common for a library to include certain code when it is compiled for an AVR such as UNO and to include different code when it is compiled for a different processor, such as a Pico W. This is managed by the use of the ifdef conditional. If this is the case you might be able to identify the corresponding code blocks for the two processors, and use that to work out why the Pico W one throws the error.

2 Likes

It appears that looking at any differences between the UNO code and the RP2040 code will not help. The difference must be in the rules that the compiler is applying.

The declaration for the variable is in the function definition.
StatusCode PCD_TransceiveData(byte *sendData, byte sendLen, byte *backData, byte *backLen, byte *validBits = nullptr, byte rxAlign = 0, bool checkCRC = false);

The usage of the variable indicates that the code is testing for whether or not there is data available, but it is not clear whether that test is intended to be that the pointer has some assigned value (it is not a null pointer) or it has a non-zero value (it is not a null pointer, but the value it points to is zero).

If the test is for a non-zero value the change would be
if (backData && (*backLen > 0)) {

However a test that has the same effect is in the next line, so it is more likely that the test is for an uninitialized pointer. In that case the change would be
if (backData && (backLen != 0)) {
(ie, change an ordered comparison to an unordered comparison). This is not technically correct, as the uninitialized value of a pointer is nullptr not zero, but it is safe to assume zero. This is the more likely fix because if that pointer is uninitialized then the code in the next line would fail at run time with a reference to protected memory.

Thank you all!
All the help has made it work!
Sorry for the delay but university has been a bit hectic the last week

– Nick

4 Likes

Hi Nick,

Glad to hear it is working. Pop back in here if there are any questions!

1 Like