-static
On systems that support dynamic linking, this overrides ‘-pie’ and prevents
linking with the shared libraries. On other systems, this option has no effect.
-static-libstdc++
When the g++ program is used to link a C++ program, it normally automatically links against ‘libstdc++’. If ‘libstdc++’ is available as a shared library, and the ‘-static’ option is not used, then this links against the shared version of ‘libstdc++’. That is normally fine. However, it is sometimes useful to freeze the version of ‘libstdc++’ used by the program without going all the way to a fully static link. The ‘-static-libstdc++’ option directs the g++ driver to link ‘libstdc++’ statically, without necessarily linking other libraries statically.
-static 在支持动态链接的系统上,这会覆盖‘-pie’选项并阻止与共享库的链接。在其他系统上,这个选项没有效果。
-static-libstdc++ 当使用g++程序链接C++程序时,它通常会自动链接到‘libstdc++’。如果‘libstdc++’作为共享库可用,并且没有使用‘-static’选项,则这会链接到‘libstdc++’的共享版本。这通常是没问题的。然而,有时候冻结程序使用的‘libstdc++’版本而不完全进行静态链接是有用的。‘-static-libstdc++’选项指示g++驱动程序静态链接‘libstdc++’,而不必静态链接其他库。