undefined reference to `std::ios_base::Init::Init()

用gcc(C编译器)编译C++程序,会报标题的错误。

原因是用gcc编译c++程序时,链接的库文件为libstdc++.so,而不是默认的libc.so,因此需要用-lstdc++参数指明,否则会在链接时发生错误.

如: gcc helloworld.cpp -lstdc++

原文地址:https://www.cnblogs.com/hencins/p/12578950.html