Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » Compile Error - probably missing something basic

Author: LittleHobbyShop
23/08/2019 14:04:37
First of all, great project! I look forward to using it but am struggling at the first hurdle.

I created a simple test menu in the designer. Two action items and one submenu with two integer items.

Using an adafruit display with the Adafruit_SSD1331 library, compiling for uno.

I'm getting compile errors:
\libraries\Adafruit_SSD1331_OLED_Driver_Library_for_Arduino/Adafruit_SSD1331.h:64:7: error: redefinition of 'class Adafruit_SSD1331'

I'm pretty new to arduino so I'm not the best at troubleshooting yet but it would seem something is getting called/included twice?

If anyone good give me a nudge in the right direction that would be great, hopefully this issue can be replicated/confirmed by someone.

P.S. being able to attach the emf file here would be a great feature

Author: davetcc
23/08/2019 16:19:36
Could you let me know which driver for the display you are using.

Also, can you zip up your menu project along with the driver and send it using the contact us form from the main page.

Thanks for letting me know that attachments are not working. I’ll look at what’s happened there.

Author: LittleHobbyShop
23/08/2019 17:56:18
It's the Adafruit_SSD1331 driver with Adafruit_GFX.

Have filled out the contact form but you'll have to mail me back as I can't attach there either smilie

Author: davetcc
24/08/2019 09:40:37
Hi there, I've sent you a mail so you should be able to respond now.

Please also let me which link (or library manager version) of the display library you used.

Author: davetcc
27/08/2019 06:59:59
I've tracked this down, it's because the 1331 library is missing an include defend block, to prevent duplicate inclusion.

I'll try and get around to putting a PR in for that library. In the mean time you can put include defends around the Adafruit_SSD1331.h file in the library.


at the top:

#ifndef _ADAFRUIT_SSD1331_H_
#define _ADAFRUIT_SSD1331_H_



importantly at the end

#endif //_ADAFRUIT_SSD1331_H_


Ensure a newline after the above.

Then it compiles for me.

Also, the sketch was missing the actual declaration of the adafruit variable. The code generator only exports the variable, you must define it in the sketch. See:

https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/tcmenu-plugins/adafruit_gfx-renderer-plugin/

Author: Admin
24/09/2020 09:38:07
We've got around this now by including the graphics header only once in the tcmenu_<projectName>.h file. As long as you don't directly include the graphics header in the main project file (ino or main.cpp) it should work fine, as all our files are protected correctly with guards.

As long as you follow the above, there should be no need to alter the graphics library source.




Register / Login  |  Desktop view  |  Jump to top of page