vscodeundefined reference to `swap2(int*, int*)' collect2.exe: error: ld returned 1 exit status
定义了头文件include“head.h”,也确实加载了,但是一直显示头文件中声明的函数未定义,因为我定义到另一个cpp文件中了,vscode没有自动连接两个cpp文件,要手动添加,或者在tasks.json里边加
cd "d:\desk\cpp\" ; if ($?) { g++ c++_1-16.cpp -o c++_1-16 } ; if ($?) { .\c++_1-16 }
改为cd "d:\desk\cpp\" ; if ($?) { g++ head.cpp c++_1-16.cpp -o c++_1-16 } ; if ($?) { .\c++_1-16 }

浙公网安备 33010602011771号