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

今天下载了MinGW试用了一下

写了下个c++代码

helloworld.cc

 

#include #include "stime.h" int main(){ Time t; PTime pt=&t; pt->hour=1; pt->minute=3; pt->second=6; std::cout<<"Hello World"<hour<minute<second; return 0; }

stime.h的内容如下

//stime.h typedef int HOUR; typedef int MINUTE; typedef int SECOND; typedef struct STime{ HOUR hour; MINUTE minute; SECOND second; }Time,*PTime;

 

用最简单的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,            Pass comma-separated on to the linker (传递逗号分隔的选项给链接器)

 

你可能感兴趣的:(MinGW中G++编译简单代码时--enable-auto-import问题)