--enable-auto-import的目的警告 [英] Purpose of --enable-auto-import Warning

查看:1181
本文介绍了--enable-auto-import的目的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译以下程序:

#include <iostream>
int main(){
    std::cout << "Hello, world!";
    return 0;
}

当我编译它,我收到这个消息:

When I compile it, I get this message:

C:\programs>g++ test.cpp
Info: resolving std::cout  by linking to __imp___ZSt4cout (auto-import)
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: a
uto-importing has been activated without --enable-auto-import specified on the c
ommand line.
This should work unless it involves constant data structures referencing symbols
 from auto-imported DLLs.

构建成功,可执行文件按预期运行,但此警告仍然令我恼火。我期望一个成功的建设完全沉默。

The build succeeds and the executable runs as expected, but this warning still irritates me. I expect a successful build to be completely silent. This message gives the false impression that there's something wrong with my code.

我可以使用 g ++ -Xlinker --enable-auto- import test.cpp ,但是这是不可取的,因为它需要编译一个程序需要输入的字符数量的三倍。

I can silence this error with g++ -Xlinker --enable-auto-import test.cpp, but this is undesirable, as it triples the number of characters I need to type to compile a program.

问题:


  • 为什么最简单的程序会出现此警告?我不会在编译Hello World时看到隐藏的警告。

  • 是否可以在不将标志传递给链接器的情况下静默此警告?在 c:\mingw 中隐藏的配置文件中的一个选项,也许?或者在安装期间可能错过了自动启用自动导入复选框?

  • Why does this warning appear for the simplest of programs? i don't expect cryptic warnings when I compile Hello World.
  • Is it possible to silence this warning without passing the flag to the linker every time? An option in a config file hidden somewhere in c:\mingw, perhaps? Or maybe I missed an "automatically enable auto-import" checkbox during installation?

可能相关规格

Possibly Relevant Specs


  • GCC版本4.5.0

  • ld.exe版本2.20.51.20100613

  • Windows XP Service Pack 3

推荐答案

像它可能与没有定义dllimport属性的mingw32 dll相关。

I did some reading and it looks like it might be related to the mingw32 dll not having dllimport attributes defined.

也许有补丁或你可以自己重建mingw32并添加它们?

Perhaps there is a patch or you can rebuild mingw32 yourself and add them?

这篇关于--enable-auto-import的目的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆