/tmp/ccrmoRpD.o:在函数`__tcf_0'': bst.cpp :(。text + 0x47):未定义引用`std :: ios_base :: Init: :~Init()'' /tmp/ccrmoRpD.o:在函数中`__static_initialization_and_destruction_0(int,int)'': bst.cpp :(。text + 0x74):undefined引用`std :: ios_base :: Init :: Init()'' /tmp/ccrmoRpD.o:(.eh_frame+0x11):未定义引用`__gxx_personality_v0'' collect2:ld返回1退出状态 prasad @ D-T11673A:〜/ programs / c>回声 Hi All,I am executing simple hello world program. But, getting compile timeerrors.What is the problem here?prasad@D-T11673A:~/programs/c> cat bst.cpp#include<iostream>using namespace std;int main (){cout << "Hello World." ;return 0 ;}prasad@D-T11673A:~/programs/c> gcc bst.cpp/tmp/ccrmoRpD.o: In function `main'':bst.cpp:(.text+0x25): undefined reference to `std::cout''bst.cpp:(.text+0x2a): undefined reference to `std::basic_ostream<char,std::char_traits<char> >& std::operator<< <std::char_traits<char>/tmp/ccrmoRpD.o: In function `__tcf_0'':bst.cpp:(.text+0x47): undefined reference to`std::ios_base::Init::~Init()''/tmp/ccrmoRpD.o: In function`__static_initialization_and_destruction_0(int, int)'':bst.cpp:(.text+0x74): undefined reference to`std::ios_base::Init::Init()''/tmp/ccrmoRpD.o:(.eh_frame+0x11): undefined reference to`__gxx_personality_v0''collect2: ld returned 1 exit statusprasad@D-T11673A:~/programs/c> echo $?1Thanks & regards,Prasad 解决方案Use g++.--Ian Collins. /tmp/ccrmoRpD.o: In function `__tcf_0'': bst.cpp:(.text+0x47): undefined reference to `std::ios_base::Init::~Init()'' /tmp/ccrmoRpD.o: In function `__static_initialization_and_destruction_0(int, int)'': bst.cpp:(.text+0x74): undefined reference to `std::ios_base::Init::Init()'' /tmp/ccrmoRpD.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'' collect2: ld returned 1 exit status prasad@D-T11673A:~/programs/c> echo 这篇关于iostream错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 15:32