5

我正在尝试使用来自http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/的 64 位 MinGW,但是当我用它编译程序时,生成的可执行文件当 DLL 不可用时失败。

如何让这个编译器与标准库进行静态链接?

还是我应该使用另一种 64 位 MinGW 发行版?

4

1 回答 1

3

g++ 开关应该是

    -static

请参阅 http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

    -static
        On systems that support dynamic linking, this prevents linking with
    the shared libraries. On other systems, this option has no effect.

您应该发布用于编译/链接的命令行,以便在这对您不起作用时获得更多帮助。

于 2012-09-02T17:31:03.337 回答