I have a C++ program which makes use of some C++ standard libraries such as iostream, vector, sstream and so on, and is only about 120 lines of code. By building it on Debian I get a 25KB executable, while when I build it on Windows 11 (both of them with just "g++ main.cpp") I normally get a 3026KB .exe. If instead I type "--shared-libstdc++" alongside g++ on Windows, I get a smaller .exe, merely 290KB.
My question is, why does compiling and linking in a Linux environment automatically do this while on Windows I have to specify it? Is there a drawback to dynamically linking the standard C++ library on Windows that G++ is aware of?
On Windows, I have: gcc version 10.3.0 (tdm64-1)
On Debian, I have: gcc version 11.3.0 (Debian 11.3.0-3)