RH 9.0 C++编译出问题,帮忙!!
最近刚装了RH 9.0,以前都没有用过
今天试试C++编译却出错了
文件名:ctest.cpp
#include <iostream.h>;
int main()
{
cout<<"yes"<<endl;
return 0;
}
# cc ctest.cpp
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
from ctest.cpp:1:
/usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning: #warning This
file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples
include substituting the <X>; header for the <X.h>; header for C++ includes, or <sstream>; instead of the deprecated header <strstream.h>;. To disable this warning
use -Wno-deprecated.
/tmp/ccBmTp05.o(.text+0x14): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char>; >;& std::endl<char, std::char_traits<char>; >;(std::basic_ostream<char, std::char_traits<char>; >;&'
/tmp/ccBmTp05.o(.text+0x21): In function `main':
: undefined reference to `std::cout'
/tmp/ccBmTp05.o(.text+0x26): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char>; >;& std:perator<< <std::char_traits<char>; >;(std::basic_ostream<char, std::char_traits<char>; >;&, char const*)'
/tmp/ccBmTp05.o(.text+0x2f): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char>; >;:perator<<(std::basic_ostream<char, std::char_traits<char>; >;& (*)(std::basic_ostream<char, std::char_traits<char>; >;&)'
/tmp/ccBmTp05.o(.text+0x5c): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccBmTp05.o(.text+0x8b): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccBmTp05.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
这到底是怎么回事啊?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Step 1:
Step 2:
#include <iostream>;
using namespace std;
不要用#include <iostream.h>;编译就OK了