For the reference I'm using MinGW (GCC 5.3). When compiling a file with
g++ file.cc -static-libstdc++
it statically links the C++ standard lib (libstdc++
) and produces a 1.9MB executable.
However running
gcc -lstdc++ -static-libstdc++ file.cc
it still dynamically links to libstdc++-6.dll
and produces a 34KB executable.
Why does -static-libstdc++
only work with g++
but not with pure gcc
?