The OS I am using is Windows 7 64-bit. I am using Code::Blocks 13.12
with MinGW-w64 (x86_64-4.9.1-posix-seh-rt_v3-rev1). (I already asked in
mingw-w64-public and was told to ask here instead.)
For this particular instance I've used these compiler options:
-O2 -std=c++11 -Wextra -Wall -march=amdfam10 -pipe -lm -lstdc++
Now that that's out of the way, I have this:
https://sourceforge.net/projects/xorshift-cpp/files/
Compiling the "main.cpp" is fine, unless I remove the "-O2" flag (i.e.
disable compiler optimisation). Then I get the following build log:
http://pastebin.com/LXRX4Pq4
The same thing happens if I remove "-march=amdfam10".
What the linker seems to specifically be complaining about:
undefined reference to `xorshift_engine<unsigned long long, 64ull,
(signed char)-25, (signed char)3, (signed char)49,
8372773778140471301ull>::shift_3'
undefined reference to `xorshift_engine<unsigned long long, 64ull,
(signed char)-25, (signed char)3, (signed char)49,
8372773778140471301ull>::shift_2'
Which makes absolutely no sense, not only because those linker errors
don't come up when compiling even with just "-O", but because, in
"xorshift.h", three constexprs in the xorshift_engine class are defined
like so:
static constexpr int_fast8_t shift_1 = a >= 0 ? a : -a;
static constexpr int_fast8_t shift_2 = b >= 0 ? b : -b;
static constexpr int_fast8_t shift_3 = c >= 0 ? c : -c;
yet shift_1 is ok, but shift_2 and shift_3 somehow aren't...? (There is
no function which does not use all three of these, in order.)
This smells like a bug in the compiler to me, but I am not sure. Can
someone please help me?
--
Ivo Doko