[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Compile Error - probably missing something basic RSS feed
Forum Index » tcMenu Arduinio library
Author Message
LittleHobbyShop


Joined: Aug 22, 2019
Messages: 2
Offline
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
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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.
LittleHobbyShop


Joined: Aug 22, 2019
Messages: 2
Offline
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
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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/
Admin

[Avatar]

Joined: Jan 19, 2019
Messages: 11
Offline
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.

TCC forum site administrator.
[WWW] [Twitter]
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.