0

I'm trying to do something with Orange Pi Zero + MFRC522 module. But got a problem.

Actually it is really simple problem : I cant compile the code.

sudo g++ -o Read Read.cpp 

In general it has to be done but, I got these errors

Read.cpp:(.text+0x38): undefined reference to `MFRC522::MFRC522()'
Read.cpp:(.text+0x42): undefined reference to `MFRC522::PCD_Init()'
Read.cpp:(.text+0x4c): undefined reference to `MFRC522::PICC_IsNewCardPresent()'
Read.cpp:(.text+0x62): undefined reference to `MFRC522::PICC_ReadCardSerial()'
collect2: error: ld returned 1 exit status

Can anyone help me about it?

Batmaca
  • 11
  • 4
  • 3
    Why `sudo`? There's no point in compiling as root. – molbdnilo Aug 22 '17 at 06:57
  • It's a linker error, you have link against the needed libraries with `-l libName` and `-L libPath` (only needed if the library is not in the search path of the linker). If the library is not precompiled you can compile it together with your program: `g++ -o Read Read.cpp MFRC522.cpp` – Andre Kampling Aug 22 '17 at 06:58
  • @molbdnilo sudo is a habbit for me now, you're right there's no point but I dont write it wilful. – Batmaca Aug 22 '17 at 07:05
  • @Batmaca It's a terrible, nasty habit. Get rid of it ASAP. – molbdnilo Aug 22 '17 at 07:13

0 Answers0