2012-02-29 50 views
0

工作正常獲取編譯錯誤,在海灣合作委員會,儘管它工作正常,在Visual Studio的C++GCC編譯錯誤,在Visual Studio 2008中C++

#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; 

這是錯誤,而試圖編譯我得到。

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' 

回答