I’m getting the following error with GCC >=9 and std>=11 merely by adding the header
to my project.
Undefined symbols for architecture x86_64:
"___emutls_v._ZN4arma19mt19937_64_instanceE", referenced from:
__GLOBAL__sub_I_Test_HPP.cpp in Test_HPP.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [Test_HPP] Error 1
make: *** [CMakeFiles/Test_HPP.dir/all] Error 2
I’ve tried various hacks including optimization flags e.g. O2, O3 etc. but finally adding the preprocessor header
apparently resolved the issue for now but I need an explanation to feel settled. If the above pre-processor is absolutely necessary to compile the code, should the armadillo library maintainers absorb the macro within the library itself? This kind of issues may take a lot of time to resolve as it is not originated in any programming logic.
Source: Windows Questions C++