C++ gcc编译错误,在visualstudio2008c++;

C++ gcc编译错误,在visualstudio2008c++;,c++,visual-c++,gcc,C++,Visual C++,Gcc,在gcc中获取编译错误,即使它在visualstudioc上运行良好++ #include <iostream> using std::cout; // tried it, didn't work using std::cin; // tried it, didn't work using std::endl; // tried it, didn't work using namespace std; #包括 使用std::cout;//试过了,没用 使用std::cin

在gcc中获取编译错误,即使它在visualstudioc上运行良好++

#include <iostream>
using std::cout;  // tried it, didn't work
using std::cin;   // tried it, didn't work
using std::endl;  // tried it, didn't work

using namespace std;
#包括
使用std::cout;//试过了,没用
使用std::cin;//试过了,没用
使用std::endl;//试过了,没用
使用名称空间std;
这就是我在编译时遇到的错误

hw2_part2.cpp:(.text+0xa2): undefined reference to `std::cout'
hw2_part2.cpp:(.text+0xa7): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
hw2_part2.cpp:(.text+0xb6): undefined reference to `std::cout'
hw2_part2.cpp:(.text+0xbb): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
hw2_part2.cpp:(.text+0xca): undefined reference to `std::cout'
hw2_part2.cpp:(.text+0xcf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
hw2_part2.cpp:(.text+0xde): undefined reference to `std::cin'
hw2_part2.cpp:(.text+0xa2):未定义对“std::cout”的引用

HP2S.PAR2..CPP:(.Text +0xA7):未定义的“STD::Basic流和STD::运算符< P> >使用<代码> G++< /COD>而不是<代码> GCC >因此,您可以在.< /P>中链接C++库 如果您感兴趣,请参阅以了解更多详细信息(尽管实际上没有更多内容)