免费注册 查看新帖 |

Chinaunix

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

[C++] 在UNIX中用C++标准库??不会,向高手请教 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-03-24 15:51 |只看该作者 |倒序浏览
我是UNIX新手,虽然学过很长时间的C++,但是在UNIX下



ultra65:test%make -f makefile2
CC -g -I//export/home/test/noDel/include/cplus  -I//export/home/test/noDel/inclc


"stl.cc", line 2: Error: Could not open include file <list.h>;.
"stl.cc", line 13: Error: list is not defined.
"stl.cc", line 13: Error: Badly formed expression.

就是这个问题 ,请教高手啊。不尽感激。

论坛徽章:
0
2 [报告]
发表于 2005-03-24 15:53 |只看该作者

在UNIX中用C++标准库??不会,向高手请教

源程序如下


#include <iostream.h>;
#include <list.h>;


int main()
{
        list<int>; dd;
        return 0;

}

论坛徽章:
0
3 [报告]
发表于 2005-03-24 16:15 |只看该作者

在UNIX中用C++标准库??不会,向高手请教

#include <iostream>;
#include <list>;
using namespace        std;


int main()
{
       list<int>; dd;
       return 0;

}

论坛徽章:
0
4 [报告]
发表于 2005-03-24 17:40 |只看该作者

在UNIX中用C++标准库??不会,向高手请教

55555~~z我知道 这是在vc中的标准写法,但好像在Unix中用不了啊~~

刚才试了一下 ,还是通不过。


源码如下

#include <iostream.h>;
#incldue <string.h>;

using namespace std;

int main()
{
        String cc="hello world,stl";

        cout<<cc<<endl;


        return 1;

}

编译结果为:

*****************************************


ultra65:test%make
CC -g -I//export/home/test/noDel/include/cplus  -I//export/home/test/noDel/inclc
"strtest.cc", line 2: Error: Unknown preprocessor directive.
"strtest.cc", line 4: Error: Type name expected instead of "using".
"strtest.cc", line 8: Error: String is not defined.
"strtest.cc", line 8: Error: cc is not defined.
"strtest.cc", line 8: Error: Badly formed expression.
"strtest.cc", line 10: Error: cc is not defined.
6 Error(s) detected.
*** Error code 6
make: Fatal error: Command failed for target `strtest.o'

论坛徽章:
0
5 [报告]
发表于 2005-03-24 17:54 |只看该作者

在UNIX中用C++标准库??不会,向高手请教

#include <iostream>;
#include <string>;

using namespace std;

int main()
{
       string cc="hello world,stl";
       cout<<cc<<endl;
     return 1;

}

g++ 编译,OK.

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
6 [报告]
发表于 2005-03-24 18:31 |只看该作者

在UNIX中用C++标准库??不会,向高手请教

原帖由 "Bonaparter" 发表:
55555~~z我知道 这是在vc中的标准写法,但好像在Unix中用不了啊~~
VC++中的标准写法不一定是标准C++的写法呀.

论坛徽章:
0
7 [报告]
发表于 2005-04-05 10:53 |只看该作者

在UNIX中用C++标准库??不会,向高手请教

具体和你用的什么unix也有关的.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP