MinGW中G++编译简单代码时--enable-auto-import问题

本文介绍了在使用MinGW的G++编译C++代码时遇到的--enable-auto-import警告问题。通过编写一个简单的示例程序,展示了如何通过添加-Wl,--enable-auto-import链接器选项来消除警告,从而成功编译程序。" 138827578,7337247,动态规划求解MDP:算法原理与应用,"['计算科学', '深度学习', '神经网络', '人工智能', '大型语言模型', 'AI', '架构设计']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天下载了MinGW试用了一下

写了下个c++代码

helloworld.cc

 

stime.h的内容如下

 

用最简单的g++ helloword.cc,编译成功但得到这些提示

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.

后来从网上找了一下原来用参数可以解决,

 

g++ -Wl,--enable-auto-import helloworld.cc -o helloword

 

好了,没有那个auto-import的提示了

 

 -Wl,<options>            Pass comma-separated <options> on to the linker (传递逗号分隔的选项给链接器)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值