Arduino Forum

Using Arduino => Displays => Topic started by: rshunter05 on Mar 25, 2019, 01:46 am

Title: Error Compiling: Conflicting Libraries TFT_22_ILI9225.h and Adafruit_GFX.h
Post by: rshunter05 on Mar 25, 2019, 01:46 am
Hello, and thanks for helping me.  This is my first post after browsing the threads for some time, but I may still commit some faus pax.  So please forgive me.

I'm using an Arduino Mega 2560 R3 and a ILI9225 TFT display.  They work fine with both the Arduino TFT and the TFT_22_ILI9225.h libraries (see bottom for links).  However, when I install and include any of the Adafruit_GFX libraries I get the following error message.  I think this line is the key to the problem, but I included it all just in case.  Mind you, I'm not sure how to even read the message.

      note: previous declaration as 'typedef struct GFXfont GFXfont'

If I need to go with different libraries that's fine.  The keys I'm looking for are being able to rotate the screen to landscape, and have about 3 different sized thick bold fonts (about 20, 50 and 80 pixels tall).

If you know of a non-GFX font I can use that would be great.  I just have no idea how to build one or install it into an Arduino sketch.

Any ideas are MORE than welcome!


Code: [Select]

Arduino: 1.8.5 (Windows 10), TD: 1.45, Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\chris\Documents\Arduino\libraries\TFT_22_ILI9225-1.4.0\src/TFT_22_ILI9225.h:25:0,

                from C:\Users\chris\Google Drive\Arduino\Screen_Tester_2\Screen_Tester_2.ino:7:

C:\Users\chris\Documents\Arduino\libraries\TFT_22_ILI9225-1.4.0\src/gfxfont.h:14:3: error: conflicting declaration 'typedef struct GFXglyph GFXglyph'

} GFXglyph;

  ^

In file included from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library/Adafruit_GFX.h:10:0,

                from C:\Users\chris\Google Drive\Arduino\Screen_Tester_2\Screen_Tester_2.ino:2:

C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library/gfxfont.h:18:3: note: previous declaration as 'typedef struct GFXglyph GFXglyph'

} GFXglyph;

  ^

In file included from C:\Users\chris\Documents\Arduino\libraries\TFT_22_ILI9225-1.4.0\src/TFT_22_ILI9225.h:25:0,

                from C:\Users\chris\Google Drive\Arduino\Screen_Tester_2\Screen_Tester_2.ino:7:

C:\Users\chris\Documents\Arduino\libraries\TFT_22_ILI9225-1.4.0\src/gfxfont.h:21:3: error: conflicting declaration 'typedef struct GFXfont GFXfont'

} GFXfont;

  ^

In file included from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library/Adafruit_GFX.h:10:0,

                from C:\Users\chris\Google Drive\Arduino\Screen_Tester_2\Screen_Tester_2.ino:2:

C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library/gfxfont.h:27:3: note: previous declaration as 'typedef struct GFXfont GFXfont'

} GFXfont;

  ^

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.




Here is my code.  Note: if you comment out the first 4 lines, it works just fine.  If any one of them is there, It won't compile.  And yes, I've installed all the necessary libraries as far as I can tell.
 
Code: [Select]


#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>

#include <TFT_22_ILI9225.h>
#include <SPI.h>



#define CS A5
#define RS A3  
#define RESET A4
#define SDI A2
#define CLK A1
#define LED A0
#define BRIGHTNESS 0
TFT_22_ILI9225 screen = TFT_22_ILI9225(RESET, RS, CS, SDI, CLK, LED);


void setup() {

 screen.begin();  
 screen.setBackgroundColor(COLOR_BLACK);
 screen.setOrientation(1);
 screen.setColor(255,255,255);
 screen.drawText(10, 10, "HI!", COLOR_GREEN);
}

void loop() {
 
 screen.drawText(50, 50, "HI!  ", COLOR_RED);  
 delay(1000);
 screen.drawText(50, 50, "BYE!", COLOR_BLUE);
 delay(1000);

}



Finally i've tried to get this working on the digital pins vs the analog.  All the examples use the digital, but none of them have ever worked unless I made them all analog.

Again, thank you for any help.
Here are the links to the TFT_22_ILI9225.h wiki as well as Adafruit GFX

TFT_22_ILI9225 wiki (https://github.com/Nkawu/TFT_22_ILI9225/wiki)

Adafruit GFX Using fonts (https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts)



Title: Re: Error Compiling: Conflicting Libraries TFT_22_ILI9225.h and Adafruit_GFX.h
Post by: rshunter05 on Mar 25, 2019, 01:53 am
Also, these libraries are supposed to work together according to the wiki.
Title: Re: Error Compiling: Conflicting Libraries TFT_22_ILI9225.h and Adafruit_GFX.h
Post by: 57Tigger57 on Mar 25, 2019, 02:19 am
First post:
Using a Mega 2560 with clone LCD 16x2 display.  

Compiling; "[Error] stdlib_noiso.h: No such file or directory."  

Previous successful compilation line had opened "LiquidCrystal.h".

Google searches for "stdlib_noiso", "stdlib_noiso.h" unsuccessful, as was searches for those terms within Arduino.cc.

Please advise.

James.
Title: Re: Error Compiling: Conflicting Libraries TFT_22_ILI9225.h and Adafruit_GFX.h
Post by: 57Tigger57 on Mar 25, 2019, 02:26 am
(sigh).
Previously opened file was "Arduino.h" according to the list of files being compiled in the Arduino IDE,
as found on the top tab of the IDE.
Title: Re: Error Compiling: Conflicting Libraries TFT_22_ILI9225.h and Adafruit_GFX.h
Post by: pert on Mar 25, 2019, 03:39 am
Also, these libraries are supposed to work together according to the wiki.
I think you are misinterpreting what the wiki says:
Quote
Adafruit has information on generating fonts for their GFX library which will work with this library: Adafruit GFX Graphics Library: Using Fonts (https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts).
What that's saying is that the fonts generated following that tutorial with work with the TFT_22_ILI9225 library. It does not mean that you can use the Adafruit GFX library and the TFT_22_ILI9225 library at the same time.

Remove the #include directives for the Adafruit GFX library and the error will go away.
Title: Re: Error Compiling: Conflicting Libraries TFT_22_ILI9225.h and Adafruit_GFX.h
Post by: rshunter05 on Mar 25, 2019, 12:06 pm
Ok...palm to forehead...I'm a complete spaz.

I think I've just been so focused on all the parts of my project that I forgot how to read.

Top it off.  The middle example from the TFT_22_ILI9225.h library is a GFX example!  I just worked throguh the first and third examples so much I didn't even see the middle one.

Thaank you again! 

I'll try it all sometime later this week...
Title: Re: Error Compiling: Conflicting Libraries TFT_22_ILI9225.h and Adafruit_GFX.h
Post by: pert on Mar 25, 2019, 12:09 pm
You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per