I'm using Keil V5.30.0.0 and ArmClang.exe V6.14.
When I tried using std::mt19937, like so:
#include <random>std::mt19937 mt;std::uniform_int_distribution< uint32_t > dist(0);auto a = dist( mt );
I got linker errors:
.\obj\rcu.axf: Error: L6200E: Symbol __stdin multiply defined (by stdio_streams.o and retarget.o)..\obj\rcu.axf: Error: L6200E: Symbol __stdout multiply defined (by stdio_streams.o and retarget.o)..\obj\rcu.axf: Error: L6200E: Symbol __stderr multiply defined (by stdio_streams.o and retarget.o).
I'm using more or less classical retarget.c, tuned for armclang.
I tried to remove those definitions from retarget.c and then got error:
.\obj\rcu.axf: Error: L6915E: Library reports error: __use_no_semihosting_swi was requested, but _sys_open was referenced
Then I removed asm(".global __use_no_semihosting_swi\n"); and my firmware hit BKPT before main, in call to _sys_open.
Why is this happening? mt19937 and uniform_int_distribution by themselves should not use any IO, should they?