Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Multiple Definition when linking #5

Closed
aaron-neal opened this issue May 18, 2022 · 3 comments
Closed

Multiple Definition when linking #5

aaron-neal opened this issue May 18, 2022 · 3 comments
Labels
wontfix This will not be worked on

Comments

@aaron-neal
Copy link

Describe the bug

I am have included Ethernet_Generic.h in my main file for starting a webserver. I also have Ethernet_Generic included in another header file for a Modbus TCP class.

On compiling I get many multiple definition errors such as
c:/users/??????/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/stm32-5mi/src/modbus/ModbusTCPSlave.cpp.o:(.bss._ZN10W5100Class4chipE+0x0): multiple definition of `W5100Class::chip'; .pio/build/stm32-5mi/src/main.cpp.o:(.bss._ZN10W5100Class4chipE+0x0): first defined here

Any help would be appreciated.

Expected behavior

When using previous Ethernet library, everything compiled as normal. Previous Library

Information

  • Latest development STM32 core
@aaron-neal
Copy link
Author

It looks like using inline on functions clears them from the multiple definitions list. e.g.:

inline int DNSClient::inet_aton(const char* address, IPAddress& result)

@khoih-prog
Copy link
Owner

Did you try and follow the instructions in multiFileProject example to avoid Multiple Definitions

This library was used in many more complex projects / libraries without error by not carelessly and blindly including any h file.

Please spend some time to research which libraries is using and how to have some ideas, if necessary.

I'm sure won't go back to the old cpp style.

Good Luck,

@khoih-prog khoih-prog added the wontfix This will not be worked on label May 18, 2022
@aaron-neal
Copy link
Author

Thank you @khoih-prog, I had not seen that example. Got me on my way. Cheers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants