You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I included unit tests inline in a few translation units. However, doing so throws the following link error, the source of which I haven't been able to track down:
File1.cpp.o (symbol from plugin): In function `sig_atomic_t':
(.text+0x0): multiple definition of `sig_atomic_t'
File2.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Error during build: exit status 1
While the type seems related to the signal headers, I haven't been able to isolate the source of the problem without breaking doctest.
Steps to reproduce
Include doctest.h with nothing else in two translation units. Compile. Cry.
The text was updated successfully, but these errors were encountered:
anthonytw
changed the title
Cannot use in multiple translation units for Arduino (avr-gcc-7.3.0)
Cannot include doctest.h in multiple translation units for Arduino (avr-gcc-7.3.0)
Feb 26, 2024
A doctest implementation inflates an otherwise empty binary by about 516KB without any optimisation flags on, and by about 155KB with -Os (gcc 9.4, c++11). Of the Arduino AVR boards, only the Mega can fit this (I think the ATmega2650 is the only one that can). The Uno and Nano only have 32KB of program storage.
Even if you addressed the size issue (or it isn't a problem for you), avr-gcc (and the Arduino Core libraries) are going to be missing a lot of functionality from the standard library because there is no need for it on a microcontroller.
Description
I included unit tests inline in a few translation units. However, doing so throws the following link error, the source of which I haven't been able to track down:
While the type seems related to the
signal
headers, I haven't been able to isolate the source of the problem without breaking doctest.Steps to reproduce
Include
doctest.h
with nothing else in two translation units. Compile. Cry.Extra information
The text was updated successfully, but these errors were encountered: