QRCode icon indicating copy to clipboard operation
QRCode copied to clipboard

error: 'QRCode' was not declared in this scope

Open claytantor opened this issue 3 years ago • 5 comments

wondering what I am doing wrong, I am attempting to compile the example in my Arduino UI

https://github.com/ricmoo/QRCode/blob/master/examples/QRCode/QRCode.ino

I have installed the library using the Library Manager...

image

also check that it is installed...

libraries$ ls -al
total 28
drwxrwxr-x 7 clay clay 4096 Nov 20 22:32 .
drwxrwxr-x 4 clay clay 4096 Nov 20 22:26 ..
drwxrwxr-x 4 clay clay 4096 Nov 20 19:10 Base64
drwxrwxr-x 4 clay clay 4096 Nov 20 19:10 Keypad
drwxrwxr-x 5 clay clay 4096 Nov 20 22:32 QRCode
drwxrwxr-x 9 clay clay 4096 Nov 20 19:10 TFT_eSPI

and when I try to compile the example,

image

/home/clay/data/github.com/ricmoo/QRCode/examples/QRCode/QRCode.ino: In function 'void setup()':
QRCode:21:5: error: 'QRCode' was not declared in this scope
     QRCode qrcode;
     ^~~~~~
QRCode:22:24: error: 'qrcode_getBufferSize' was not declared in this scope

shouldn't it be able to find QRCode? If it is inappropriate to post this here and its not a bug happy to close and move the conversation.

claytantor avatar Nov 21 '21 04:11 claytantor

so I think I may know what the problem is, QRCode as a directory name instead of all lower case qrcode to match the import may be an issue with my version of the compiler finding the import of qrcode.h.

claytantor avatar Nov 21 '21 16:11 claytantor

@claytantor did you find a way to fix this? I am getting the same error

elgranshaman avatar Dec 09 '21 10:12 elgranshaman

The problem for me was that the ESP32 board package also has a qrcode.h. You can get around it by renaming this library's header (and so also the includes in src/qrcode.c and your code).

bluecamel avatar Apr 15 '22 20:04 bluecamel

Really stupid mistake, but the circumnavigate works, thanks!

AxelHamburch avatar Apr 20 '23 11:04 AxelHamburch

Worked for me also, renamed 'qrcode.h' and 'qrcode.c' to 'qrcode_gen.h' and 'qrcode_gen.c', then also tweaked the 'include' line in qrcode.c.

DalbyTech avatar Feb 26 '24 16:02 DalbyTech