Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: conflicting declaration 'i2c_t3 Wire'

  1. #1
    Senior Member
    Join Date
    Oct 2015
    Posts
    227

    conflicting declaration 'i2c_t3 Wire'

    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.
    Attached Files Attached Files

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,811
    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 ...

  3. #3
    Senior Member
    Join Date
    Oct 2015
    Posts
    227
    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_Lib rary/Adafruit_MCP23017.h:24:20: fatal error: Wire.h: No such file or directory

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,811
    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.

  5. #5
    Senior Member
    Join Date
    Oct 2015
    Posts
    227
    That worked...thanks much!

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,811
    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.

  7. #7
    Senior Member
    Join Date
    Oct 2015
    Posts
    227
    Yes, Wire.h was in that file.

  8. #8
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin TX
    Posts
    415
    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


    Quote Originally Posted by rfresh737 View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •