如题,写了个C++文件,手贱用gcc去编译,报错『undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status』
错误原因是gcc无法自动链接C++标准库,需要人为指定,所以改成g++就解决啦!
谨记,gcc命令编译C程序文件.c,g++编译C++程序文件.cpp
gcc -o hello hello.c
g++ -o hello hello.cpp
如题,写了个C++文件,手贱用gcc去编译,报错『undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status』
错误原因是gcc无法自动链接C++标准库,需要人为指定,所以改成g++就解决啦!
谨记,gcc命令编译C程序文件.c,g++编译C++程序文件.cpp
gcc -o hello hello.c
g++ -o hello hello.cpp
本文标题:2. C++ 文件在Linux用gcc编译报错『undefine
本文链接:https://www.haomeiwen.com/subject/wthxzttx.html
网友评论