Library problem Solved

I am trying to compile the following example.

#if 0
#include <SPI.h>
#include <PN532_SPI.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_SPI pn532spi(SPI, 10);
NfcAdapter nfc = NfcAdapter(pn532spi);
#else

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
#endif

void setup(void) {
    Serial.begin(9600);
    Serial.println("NDEF Reader");
    nfc.begin();
}

void loop(void) {
    Serial.println("\nScan a NFC tag\n");
    if (nfc.tagPresent())
    {
        NfcTag tag = nfc.read();
        tag.print();
    }
    delay(5000);
}

I am getting errors which I think are library related.

In file included from ReadTag.ino:17:
C:\Users\Home\Desktop\arduino\libraries\PN532_I2C/PN532_I2C.h:6:28: error: PN532Interface.h: No such file or directory
In file included from ReadTag.ino:17:
C:\Users\Home\Desktop\arduino\libraries\PN532_I2C/PN532_I2C.h:8: error: expected class-name before '{' token
In file included from ReadTag.ino:18:
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:48: error: 'boolean' does not name a type
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:60: error: 'boolean' does not name a type
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:67: error: 'boolean' does not name a type
In file included from C:\Users\Home\Desktop\arduino\libraries\NDEF/NfcAdapter.h:5,
                 from ReadTag.ino:19:
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:42: error: redefinition of 'class PN532'
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:42: error: previous definition of 'class PN532'
In file included from C:\Users\Home\Desktop\arduino\libraries\NDEF/MifareClassic.h:5,
                 from C:\Users\Home\Desktop\arduino\libraries\NDEF/NfcAdapter.h:10,
                 from ReadTag.ino:19:
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:42: error: redefinition of 'class PN532'
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:42: error: previous definition of 'class PN532'
In file included from C:\Users\Home\Desktop\arduino\libraries\NDEF/MifareUltralight.h:4,
                 from C:\Users\Home\Desktop\arduino\libraries\NDEF/NfcAdapter.h:11,
                 from ReadTag.ino:19:
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:42: error: redefinition of 'class PN532'
C:\Users\Home\Desktop\arduino\libraries\PN532_SPI/PN532.h:42: error: previous definition of 'class PN532'
In file included from ReadTag.ino:19:
C:\Users\Home\Desktop\arduino\libraries\NDEF/NfcAdapter.h:25: error: expected `)' before '&' token
ReadTag:22: error: no matching function for call to 'NfcAdapter::NfcAdapter(PN532_I2C&)'
C:\Users\Home\Desktop\arduino\libraries\NDEF/NfcAdapter.h:23: note: candidates are: NfcAdapter::NfcAdapter()
C:\Users\Home\Desktop\arduino\libraries\NDEF/NfcAdapter.h:23: note:                 NfcAdapter::NfcAdapter(const NfcAdapter&)

I am getting errors which I think are library related.

I think you forgot something...

:blush:

AFAICS everythin is in the right place following the instructions here.

http://www.seeedstudio.com/wiki/NFC_Shield_V2.0

C:\Users\Home\Desktop\arduino\libraries\PN532_I2C/PN532_I2C.h:6:28: error: PN532Interface.h: No such file or directory

I'm pretty sure that even the greenest programmer can figure this one out.

A link to the library is in order.

sorry having problems with freezing.

sorry having problems with freezing.

I thought global warming was supposed to deal with that.

PN532Interface.h: No such file or directory

iv checked and its definatley in the library directory.

Where in the lib dir?

Mark

in the PN532 subdirectory of the library folder.

Then it's in the wrong place. The IDE requires that the files fred.h and fred.cpp be in the dir fred in the libs dir.

Don't forget to restart the IDE after making the changes.

Mark

It is also in the PN532_I2C directory. If thats whay you mean , i copied it manually into all relevant subfolders of the library.

Thanks , it appears i had downloaded an older version off github.

Glad to see your problem solved BUT ADD " solved" to the title don't jut change the title. At the time of posting your running at 10x reads to replies and many of the reads are others with the same problem....

Mark

OK my bad.
Last time i did stuff i had similar problems with libraries.
Old libraries, wrong or old libraries , modified libraries with changes to variable names etc.

Fixed by a new install and new libraries, now my older sketches do not compile any more.

Oh well

Boardburner2:
Fixed by a new install and new libraries, now my older sketches do not compile any more.

You still have not reinstated the proper title to your original post !!

On Linux (at least) it is easy to install different versions of the Arduino IDE so that you can use whichever is appropriate for a particular project.

...R

It's easy on Windows too as long as the user contributed libraries are where they should be.

Robin2:

Boardburner2:
Fixed by a new install and new libraries, now my older sketches do not compile any more.

You still have not reinstated the proper title to your original post !!

The original title wasn’t all that much better.

AWOL:
The original title wasn't all that much better.

I agree, but even such a small improvement would help.

...R

My apologies , i hope the new title is suitable.