The EncoderTool is a library to manage and read out rotary encoders connected either directly or via multiplexers to ARM based boards. Encoder push buttons are supported. Callback functions can be attached to encoder changes and button presses to allow for event driven applications
MIT License
48
stars
12
forks
source link
Library impossible to include from two cpp files #22
Due to the Encoder.h class inlining the implementation, two files using the Encoder after doig #include <EncoderTool.h> will result in a double definition error.
Minimal reproduction with PlatformIO:
platformio.ini
.pio\build\teensy41\src\main.cpp.o: In function `EncoderTool::Encoder::Encoder()':
main.cpp:(.text._ZN11EncoderTool7EncoderC2Ev+0x0): multiple definition of `EncoderTool::Encoder::Encoder()'
.pio\build\teensy41\src\helper.cpp.o:helper.cpp:(.text._ZN11EncoderTool7EncoderC2Ev+0x0): first defined here
c:/users/max/.platformio/packages/toolchain-gccarmnoneeabi@1.50401.190816/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
.pio\build\teensy41\src\main.cpp.o: In function `EncoderTool::Encoder::Encoder()':
main.cpp:(.text._ZN11EncoderTool7EncoderC2Ev+0x0): multiple definition of `EncoderTool::Encoder::Encoder()'
.pio\build\teensy41\src\helper.cpp.o:helper.cpp:(.text._ZN11EncoderTool7EncoderC2Ev+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
See topic.
Due to the
Encoder.h
class inlining the implementation, two files using theEncoder
after doig#include <EncoderTool.h>
will result in a double definition error.Minimal reproduction with PlatformIO:
platformio.ini
with
src/main.cpp
and
src/helper.cpp
leads to