CentOS6.4中,g++编译问题,如何解决?求解。。。 20
前几天还好好的,今天g++出问题了,编译c++文件出现以下信息:[root@localhostmaptest]#g++hello.cppInfileincludedfro...
前几天还好好的,今天g++出问题了,编译c++文件出现以下信息:
[root@localhost maptest]# g++ hello.cpp
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/localefwd.h:42,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:42,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iostream:40,
from hello.cpp:3:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:52: error: ‘uselocale’ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:52: error: invalid type in declaration before ‘;’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:72: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:97: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
hello.cpp文件内容如下:
#include <iostream>
using namespace std;
int main(){
cout<<"Hello, world!"<<endl;
return 0;
} 展开
[root@localhost maptest]# g++ hello.cpp
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/localefwd.h:42,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:42,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iostream:40,
from hello.cpp:3:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:52: error: ‘uselocale’ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:52: error: invalid type in declaration before ‘;’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:72: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux/bits/c++locale.h:97: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
hello.cpp文件内容如下:
#include <iostream>
using namespace std;
int main(){
cout<<"Hello, world!"<<endl;
return 0;
} 展开
2个回答
展开全部
第一安装的时候存在安装不完整,第二你应该不是在终端中运行的,如果是的话,你可以安装一个编程软件试试。可以检查具体是什么原因
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
文件丢失。重新安装
追问
我把gcc全部卸载后,重装gcc,使用g++时,还是有这个问题。
追答
你的安装文件里自带的库文件也许出问题了。建议重新下新的。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询