免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2439 | 回复: 4
打印 上一主题 下一主题

[FreeBSD] 问一个菜问题---怎么在FREEBSD下用C++? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-03-26 17:28 |只看该作者 |倒序浏览
我是个新手,想在FREEBSD下学习C++,已经装了GCC,编译C程序很正常,可是编译C++程序就出问题:老是出现如下错误:
bash-2.05b$ g++ Hello.cpp -o hello
In file included from /usr/include/g++/backward/iostream.h:31,
                 from Hello.cpp:1:
/usr/include/g++/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.
或者是:
bash-2.05b$ g++ file2.C -o file2
file2.C: In function `int main()':
file2.C:5: `cout' undeclared (first use this function)
file2.C:5: (Each undeclared identifier is reported only once for each function
   it appears in.)
file2.C:7: `cin' undeclared (first use this function)
请各位指教,我刚学,比较菜,如能说详细点,不盛感激

论坛徽章:
0
2 [报告]
发表于 2003-03-26 18:00 |只看该作者

问一个菜问题---怎么在FREEBSD下用C++?

源文件贴出来

论坛徽章:
0
3 [报告]
发表于 2003-03-26 18:24 |只看该作者

问一个菜问题---怎么在FREEBSD下用C++?

好象是头文件的缺省目录不对。使用/usr/include/g++/试试。

论坛徽章:
0
4 [报告]
发表于 2003-03-26 18:33 |只看该作者

问一个菜问题---怎么在FREEBSD下用C++?

...


楼主看一下编译信息,原因和解决的办法都在这里解释得很清楚了呀!

bash-2.05b$ g++ Hello.cpp -o hello
In file included from /usr/include/g++/backward/iostream.h:31,
from Hello.cpp:1:
/usr/include/g++/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.
或者是:
bash-2.05b$ g++ file2.C -o file2
file2.C: In function `int main()':
file2.C:5: `cout' undeclared (first use this function)
file2.C:5: (Each undeclared identifier is reported only once for each function
it appears in.)
file2.C:7: `cin' undeclared (first use this function)

论坛徽章:
5
荣誉会员
日期:2011-11-23 16:44:17CU大牛徽章
日期:2013-09-18 15:15:15CU大牛徽章
日期:2013-09-18 15:15:45未羊
日期:2014-02-25 14:37:19射手座
日期:2014-12-26 22:55:37
5 [报告]
发表于 2003-03-26 20:46 |只看该作者

问一个菜问题---怎么在FREEBSD下用C++?

老问题了,你的程序肯定没有按照新的C++变种标准写,cout实在namespace std中的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP