ricmoo / QRCode

QR code generation library in C, optimized for low-power devices, such as Arduino.
Other
638 stars 202 forks source link

error: 'QRCode' was not declared in this scope #31

Open claytantor opened 2 years ago

claytantor commented 2 years ago

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 commented 2 years ago

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.

elgranshaman commented 2 years ago

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

bluecamel commented 2 years ago

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).

AxelHamburch commented 1 year ago

Really stupid mistake, but the circumnavigate works, thanks!

DalbyTech commented 4 months ago

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.