Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile error multiple definition of `Wire' #25528

Closed
1 task done
GuttalBug opened this issue Mar 16, 2023 · 10 comments
Closed
1 task done

compile error multiple definition of `Wire' #25528

GuttalBug opened this issue Mar 16, 2023 · 10 comments

Comments

@GuttalBug
Copy link

GuttalBug commented Mar 16, 2023

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

I am trying to use soft_i2c_eprom, I use the following declaration:

#if NO_EEPROM_SELECTED
 //#define EEPROM_SETTINGS
 #define I2C_EEPROM
 #define SOFT_I2C_EEPROM
 #undef I2C_SDA_PIN
 #define I2C_SDA_PIN                           70
 #undef I2C_SCL_PIN
 #define I2C_SCL_PIN                           71
 #define MARLIN_EEPROM_SIZE                    0x7FFF  // 32K (25LC256)
 #undef NO_EEPROM_SELECTED
#endif

but wen I compile with Visual Studio Code I get the duplicate "Wire" definition error. If I remove the #define I2C_EEPROM statment I can compile but Marlin use eeprom emulation.
Marlin configuration.zip

Bug Timeline

No response

Expected behavior

No response

Actual behavior

No response

Steps to Reproduce

No response

Version of Marlin Firmware

02010200

Printer model

custom corexy

Electronics

board with arduino due

Add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

OctoPrint

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

No response

@ellensp
Copy link
Contributor

ellensp commented Mar 17, 2023

Since BOARD_CABER is totally custom,we have no idea what platform this is on and absolutely no way to even start looking at this

You need to provide sufficient information so we can replicate the issue.

No Boards pin.h file
No build environment details
Not even a error log.

@GuttalBug
Copy link
Author

Thanks for the answer, I include the the pin definition for BOARD_CABER.
pins_CABER.zip
The solution that I have found is to modify eeprom_if_i2c.cpp renaming "wire" to "wiregg".
eeprom_if_i2c.zip
The solution work perfectly but I don't know if there is a more elegant solution

@GuttalBug GuttalBug reopened this Mar 18, 2023
@GuttalBug
Copy link
Author

sorry I closed for mistake

@selahattinerdal
Copy link

selahattinerdal commented Mar 29, 2023

Same problem. I have changed in eeprom_if_i2c.cpp

#if ENABLED(SOFT_I2C_EEPROM)
  #include <SlowSoftWire.h>
  SlowSoftWire Wire = SlowSoftWire(I2C_SDA_PIN, I2C_SCL_PIN, true);
#else
  #include <Wire.h>
#endif

to

  #include <Wire.h>

and its worked.

@GuttalBug
Copy link
Author

with your solution you still use hardware I2c and not the SlowSoftWire that alluw to use any I/O pin

@thinkyhead
Copy link
Member

The pins files define (or don't define) SOFT_I2C_EEPROM. So the simpler solution is to not define it in your pins file.

@GuttalBug
Copy link
Author

But if I not define SOFT_I2c_EEPROM how can use generic I/O pins for I2C bus ?

@thisiskeithb
Copy link
Member

This was probably fixed in #25707.

Please download bugfix-2.1.x to test with the latest code and let us know if you're still having this issue.

@GuttalBug
Copy link
Author

I test with the last build and the problem is fixed. Thanks to all

@github-actions
Copy link

github-actions bot commented Jul 2, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants