LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 818|回复: 2

编译一个简单的程序总提示这个错误, 请问是哪里的设置错误了

[复制链接]
发表于 2006-2-19 02:20:28 | 显示全部楼层 |阅读模式
[PHP]#include <stdlib.h>
#include <iostream.h>

int main() {
//      printf("%d", 10);
        cout << "x";
        return 1;
}[/PHP]


编译上面一个简单的程序总提示这个错误, 请问是哪里的设置错误了?

root@ubuntu:/home/anguskwan/cpp# gcc -o test test.cpp
In file included from /usr/include/c++/4.0.2/backward/iostream.h:31,
                 from test.cpp:2:
/usr/include/c++/4.0.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 <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
/tmp/ccY5TNhr.o: In function `main':
test.cpp.text+0x25): undefined reference to `std::cout'
test.cpp.text+0x2a): 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/ccY5TNhr.o: In function `__tcf_0':
test.cpp.text+0x47): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccY5TNhr.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp.text+0x74): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccY5TNhr.o.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld 返回 1
root@ubuntu:/home/anguskwan/cpp#
发表于 2006-2-19 05:16:00 | 显示全部楼层
#include <iostream>
#include <cstdlib>
using namespace std;

我习惯是这样,你试试
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-19 14:19:10 | 显示全部楼层
thx!!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表