这次的问题起源于我用容器array时需要包含头文件。
而刚刚好用到的容器array是C++11中新加入std库的,但是我的MinGw版本太低,出现了找不到库的情况。遂将自己的MinGw升级到了最新版本,此时问题出现,不知怎么的运行后报错了
报错如下:
PS D:\Work> cd "d:\Work" ; if ($?) { gcc ok.cpp -o ok.exe -std=c++11 -Wall -lm } ; if ($?) { ./ok.exe }
C:\Users\Dylan\AppData\Local\Temp\ccJuQfKx.o:ok.cpp:(.text+0x21): undefined reference to `std::ostream::operator<
C:\Users\Dylan\AppData\Local\Temp\ccJuQfKx.o:ok.cpp:(.text+0x40): undefined reference to `std::ios_base::Init::~Init()'
C:\Users\Dylan\AppData\Local\Temp\ccJuQfKx.o:ok.cpp:(.text+0x70): undefined reference to `std::ios_base::Init::Init()'
C:\Users\Dylan\AppData\Local\Temp\ccJuQfKx.o:ok.cpp:(.rdata$.refptr._ZSt4cout[.refptr._ZSt4cout]+0x0): undefined reference to `std::cout'
collect2.exe: error: ld returned 1 exit status
显然是