conflicting declaration 'i2c_t3 Wire'

Status
Not open for further replies.

rfresh737

Well-known member
I'm getting the following compile error using my Teensy 3.6 and the attached code:

I read somewhere that I cannot use the Wire.h lib and the i2c_t3.h lib.

I renamed the following folder...

Code:
C:\Arduino\hardware\arduino\avr\libraries\Wire

to

Code:
C:\Arduino\hardware\arduino\avr\libraries\Wire_Old

...in an attempt to remove the Wire.h lib but got the same compile error (below).

So, I'm not sure now how to fix this.

Code:
In file included from C:\Users\rfresh1011\Documents\FS1000_2017\FS1000MCP23017PortExpanderV5\FS1000MCP23017PortExpanderV5.ino:2:0:

C:\Arduino\hardware\teensy\avr\libraries\i2c_t3/i2c_t3.h:972:15: error: conflicting declaration 'i2c_t3 Wire'

extern i2c_t3 Wire;

Sketch attached.
 

Attachments

  • FS1000MCP23017PortExpanderV5.ino
    15.4 KB · Views: 101
Indeed those two define the same WIRE class and has to be one or the other. Is there an explicit include of wire.h in any other library used? That would need to be changed too. Or possible the library using 'WIRE' will need an explicit include for i2c_t3 so the IDE doesn't just include it as needed.

Hacking the name to _Old won't be enough as the IDE can look deeper that the folder name.

That's a guess that might help ...
 
I did a search on my hard drive and found two locations containing Wire.h

This is my Ardunio installation folder:

C:\Arduino\hardware\teensy\avr\libraries\Wire

and

C:\Arduino\hardware\arduino\avr\libraries\Wire\src

I renamed both of these Wire.h files (to Old_Wire.h) so they won't get picked up in the compile but now get this compiler err msg:

C:\Arduino\libraries\Adafruit_MCP23017_Arduino_Library/Adafruit_MCP23017.h:24:20: fatal error: Wire.h: No such file or directory
 
That suggests that: C:\Arduino\libraries\Adafruit_MCP23017_Arduino_Lib rary/Adafruit_MCP23017.h

Has a need for Wire.h - I would put the :: #include <i2c_t3.h>

There to replace wire.h if explicitly or implicitly there in some fashion.
 
:cool: Was wire.h in that file? I'm never sure about how much the IDE bends the rules to make stuff work picking up things implicitly.
 
The problem is likely that you are using the Adafruit_MCP23017 library, which since it uses I2C, you will need to make sure inside that library to change Wire.h to i2c_t3.h also. If the Adafruit library tried to include Wire.h and your sketch includes i2c_t3.h they will collide.

Edit: didn't see followup posts, nevermind


I'm getting the following compile error using my Teensy 3.6 and the attached code:

I read somewhere that I cannot use the Wire.h lib and the i2c_t3.h lib.

I renamed the following folder...

Code:
C:\Arduino\hardware\arduino\avr\libraries\Wire

to

Code:
C:\Arduino\hardware\arduino\avr\libraries\Wire_Old

...in an attempt to remove the Wire.h lib but got the same compile error (below).

So, I'm not sure now how to fix this.

Code:
In file included from C:\Users\rfresh1011\Documents\FS1000_2017\FS1000MCP23017PortExpanderV5\FS1000MCP23017PortExpanderV5.ino:2:0:

C:\Arduino\hardware\teensy\avr\libraries\i2c_t3/i2c_t3.h:972:15: error: conflicting declaration 'i2c_t3 Wire'

extern i2c_t3 Wire;

Sketch attached.
 
Status
Not open for further replies.
Back
Top