hideakitai / MsgPacketizer

msgpack based serializer / deserializer + packetize for Arduino, ROS, and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#include <MsgPacketizer.h> in multiple source files

dwjbosman opened this issue · comments

I have 2 cpp files both contain a line #include<MsgPacketizer.h>

The code is compiled for Arduino

I have enabled logging:
#define MSGPACKETIZER_ENABLE_DEBUG_LOG

(but even with DEBUG_LOG disabled some multiple definitions still exist)

During linking I get an error:

tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/plg_rtd.cpp.o (symbol from plugin): In function arx::debug::log_level': (.text+0x0): multiple definition of arx::debug::log_level'
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/iMaxi2Sensor.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/plg_rtd.cpp.o (symbol from plugin): In function arx::debug::log_level': (.text+0x0): multiple definition of arx::debug::b_only_sd'
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/iMaxi2Sensor.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/plg_rtd.cpp.o (symbol from plugin): In function arx::debug::log_level': (.text+0x0): multiple definition of arx::debug::b_auto_save'
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/iMaxi2Sensor.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/plg_rtd.cpp.o (symbol from plugin): In function arx::debug::log_level': (.text+0x0): multiple definition of arx::debug::logger'
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/iMaxi2Sensor.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/plg_rtd.cpp.o (symbol from plugin): In function arx::debug::log_level': (.text+0x0): multiple definition of arx::debug::stream'
/tmp/arduino-sketch-CBB01DD9DE742798D756B54022239E3C/sketch/iMaxi2Sensor.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

Ahh... ok, I should try to fix that but maybe it takes some time...
Can you show me another multiple definitions without #define MSGPACKETIZER_ENABLE_DEBUG_LOG ?

In the end I hacked it by creating a define DEBUG_EXTERN and if set replacing all declarations with extern definitions.

Unfortunately It seems I can't use Debugging and MSgPacketizer together because too much RAM is needed on my 2048 byte Arduino :(

@dwjbosman Sorry for the late reply, fix this issue in v0.2.15. Thanks!