fix: template specializations in ArtnetWiFi.h cause multiple definition linker errors in multi-file C++ projects (v0.9.1)#151
Merged
hideakitai merged 1 commit intohideakitai:mainfrom Oct 19, 2025
Conversation
…on linker errors in multi-file C++ projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello again,
I've been running into a linker issue, when using the 0.9.1 in my C++ project.
Below is the analysis of Claude Code, please take it with a grain of salt, it could be garbage and I'm doing it wrong. If so, my apologies. But, adding the inline keywords fixes the issue for my build.
Thank you for a cool library!
The template specializations for
getLocalIP,getSubnetMask,getMacAddress, andisNetworkReadyinArtnetWiFi.h(lines 102, 108, 114, 120) (and the other .h files) are missing theinlinekeyword, causing ODR (One Definition Rule) violations when the header is included in multiple translation units.Error Example:
Affected Code (ArtnetWiFi.h):
Fix: Add inline keyword to all four template specializations (lines 102, 108, 114, 120):
Why this happens:
Simple Arduino sketches (single .ino file) work fine because they compile to one translation unit
Multi-file C++ projects fail because the template specializations get compiled into multiple object files
The linker sees duplicate symbols and fails
Impact of fix:
✅ No behavior change for existing working code
✅ No performance impact
✅ Fixes multi-file C++ projects (PlatformIO, Arduino with multiple .cpp files)
✅ Standard C++ practice for header-only template specializations