Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
claytantor opened this issue Nov 21, 2021 · 6 comments
Open

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

claytantor opened this issue Nov 21, 2021 · 6 comments

Comments

@claytantor
Copy link

claytantor commented Nov 21, 2021

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
Copy link
Author

claytantor commented Nov 21, 2021

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
Copy link

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

@bluecamel
Copy link

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
Copy link

Really stupid mistake, but the circumnavigate works, thanks!

@DalbyTech
Copy link

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.

@codewithzahid
Copy link

I encountered a similar issue where there was a conflict between the ESP32 board package and a library with the same name. To resolve this, I copied the header files (qrcode.h and qrcode.cpp) directly into my main code and included them using #include "qrcode.h". This approach successfully fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants