/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

posted @ 2023-05-19 16:30  败人两字非傲即惰  阅读(148)  评论(0编辑  收藏  举报