Open papylhomme opened 6 years ago
Minimal example to reproduce: https://github.com/papylhomme/MySensorsTest
Hey, I have the same problem. Did you manage to find the solution?
Hey, I have the same problem. Did you manage to find the solution?
@wi1k1n Which MySensors version do you use? This issue is related to ver. 2.2 which is outdated now. Did you tried to use current ver. 2.3.2 or 2.4.0-alpha?
A working example to reproduce your issue would be fine. Unfortunately the mini example link from @papylhomme is pointing to 404 :-(
I'm using v2.3.2 with PlatformIO. This error occurred when I was trying to make several classes for my sensors with some inheritance (basically the including of
I've already made some kind of stupid workaround on it in my project (simply placing everything in one main.cpp to avoid multiple inclusion of MySensors.h), but for now I cannot recreate this issue again (strange, apparently I did something else, when I got this problem). I'll probably catch this issue again when doing some refactoring (in the near future). I'll update here if I face this problem again or not.
Thanks for answering!
I am not sure how I solved above problem but I see NOTE in my code that #include'ing
Also I see that I am including
#include <core/MySensorsCore.h>
in all my library headers where needed, and
#include <MySensors.h>
#include <MyOwnLibraryExtendingMySensors.h>
only in main project file (ino).
Sorry for the missing link. I haven't played with MySensors for a while now and I remember the problem only vaguely, @matkor solution seems to be the way to go
Ah, I see. I'll try it. @matkor , @MichaelLhommeOFP thanks a lot for helping out!
Ah, I see. I'll try it. @matkor , @MichaelLhommeOFP thanks a lot for helping out!
@wi1k1n If you find a working solution to this problem it would be very nice to share it here. Maybe then this old issue can be closed. Thank you
I ran into this problem when trying to refactor the nrf24Doctor. The device couldn't measure the current consumption. I tried reviewing the code but failed. So I went on to refactor the code to make it more readable, at least to me.
Pointed by the answers of @wi1k1n and @matkor managed to work around the re-definition issue in MySensors - ..
The problem is that inside MySensors, there is a lot of inclusion of implementations rather than abstractions.
My workaround is defining a component that wraps MySensors usage into a component - .. And only including MySensors library once into the implementation of this component - .
I hope this can help. L.
I'm trying to update my projects to 2.2, but compilation fails with linking errors.
All of my sketches are using multiple cpp/h files structured as follow:
config.h
defining configurationconfig.h
andMySensors.h
config.h
andMySensors.h
, the code includes the headerThis results in the following errors: