Purpose of --enable-auto-import Warning(--enable-auto-import 警告的目的)
问题描述
我正在尝试编译以下程序:
I am trying to compile the following program:
#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?
可能相关的规格
- 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 警告的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:--enable-auto-import 警告的目的
基础教程推荐
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 从 std::cin 读取密码 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01