LinuxSir.cn,穿越时空的Linuxsir!

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

一个简单的Hello word 问题(g++),编译通不过

[复制链接]
发表于 2005-5-25 10:38:33 | 显示全部楼层 |阅读模式
#include "iostream"
using namespace std;

int main()
{
cout << "Hello word" << endl;
return 0;
}

g++ -o first first.cpp

为什么会出问题

In file included from /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/iosfwd:46,
from /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/ios:44,
from /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/ostream:45,
from /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/iostream:45,
from first.cpp:1:
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/c++locale.h:55: error: `uselocale' was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/c++locale.h:55: error: invalid type in declaration before ';' token
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/c++locale.h: In function `int std::__convert_from_v(char*, int, const char*, _Tv, __locale_struct* const&, int)':
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/c++locale.h:73: error: `__gnu_cxx::__uselocale' cannot be used as a function
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/c++locale.h:90: error: `__gnu_cxx::__uselocale' cannot be used as a function

我在两个全新的系统上都出现这个问题(Fedora 3 & Suse Enterprise)
发表于 2005-5-25 10:44:41 | 显示全部楼层
#include <iostream>
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-25 10:48:20 | 显示全部楼层
Post by nait
#include <iostream>


这不是主要问题吧,改了以后还是出同样的错误
回复 支持 反对

使用道具 举报

发表于 2005-5-25 11:11:06 | 显示全部楼层
系统的开发环境没有安装好,重新安装吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-25 12:29:36 | 显示全部楼层
Post by kj501
系统的开发环境没有安装好,重新安装吧。


我用google搜索了一下,也是说是开发环境的问题,
但是要怎么重装啊,
我用Fedora安装盘上的RPM安装包,把gcc,g++,kernelheader,glibcheader,都重装了,
可是还是不行
你能说的具体点吗,需要使用安装哪些包?是不是要使用源码安装啊

:help  :help  :help
回复 支持 反对

使用道具 举报

发表于 2005-5-26 16:43:58 | 显示全部楼层
gcc和glibc的dev包都安装了?!!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-26 20:34:30 | 显示全部楼层
Post by kj501
gcc和glibc的dev包都安装了?!!


那些东西当然安装了

RedHat Fedora的软件包安装时的依赖关系实在是麻烦,一气之下装了SuSE,他们的安装方式就比较好
回复 支持 反对

使用道具 举报

发表于 2005-5-26 23:47:27 | 显示全部楼层
可能是libstdc++没有装
你将编译和连接分开看看
回复 支持 反对

使用道具 举报

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

本版积分规则

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