/usr/bin/ld: /tmp/ccBYHb6O.o: in function __static_initialization_and_destruction_0(int, int)': test1.cpp:(.text+0x44): undefined reference tostd::ios_base::Init::Init()’ /usr/bin/ld: test1.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()’ collect2: error: ld returned 1 exit status
我之前可以正常使用 gcc xxx.cpp -o xxx
但是最近不知道怎么地不能用了, 我把gcc换成g++,如下图

下图是我源代码:

我看网上的方法,都很复杂,但能编译就行了,以我目前的能力也就这样,希望大家多多指点!
博主分享了遇到的编译问题,涉及到`std::ios_base::Init`的undefined reference,展示了源代码,并求助于简单易懂的解决步骤。
2622

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



