/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/Administrator/AppData/Local/Temp/ccAmN6et.o...
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/c/Users/Administrator.Bili-2022AOYNWU/AppData/Local/Temp/ccAmN6et.o:.\main.cpp:(.text+0x5a): undefined reference to `std::ios_base::Init::Init()'
/cygdrive/c/Users/Administrator.Bili-2022AOYNWU/AppData/Local/Temp/ccAmN6et.o:.\main.cpp:(.text+0x5a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::ios_base::Init::Init()'
原因:用gcc编译了.cpp文件
解决方法:
将
gcc .\main.cpp .\person.cpp -o a;a
改为
g++ .\main.cpp .\person.cpp -o a;a