# gcc alantop.cpp
/tmp/cchoAlDx.o: In function `__static_initialization_and_destruction_0(int, int )':
alantop.cpp:(.text+0x38): undefined reference to `std::ios_base::Init::Init()'
alantop.cpp:(.text+0x3d): undefined reference to `std::ios_base::Init::~Init()'
/tmp/cchoAlDx.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
增加编译参数 -lstdc++
增加编译参数 -lstdc++
# gcc alantop.cpp -lstdc++
本文介绍了解决GCC编译过程中出现的未定义引用错误的方法。通过添加-lstdc++编译参数解决了与标准C++库初始化相关的链接错误。
8123

被折叠的 条评论
为什么被折叠?



