LinuxSir.cn,穿越时空的Linuxsir!

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

关于#include <iostream.h>请教

[复制链接]
发表于 2004-3-11 12:04:26 | 显示全部楼层 |阅读模式
我的程序是这样的:
#include <iostream.h>
main()
{
   int a,b,c;
   a=5;
   b=2;
   c=a+b;
   printf(c);
}
gcc的时候出现找不到iostream.h文件,printf不能使用
请问是什么问题。
我刚开始学linux-c,谢谢。
发表于 2004-3-11 13:22:49 | 显示全部楼层
看看/usr/include下面有这个h文件么
发表于 2004-3-11 14:36:07 | 显示全部楼层
用#include <stream>吧,用g++编译
 楼主| 发表于 2004-3-11 15:25:02 | 显示全部楼层
my program is:
#include <stdio.h>
void main()
{
    int a,b,c;
    a=5;
    b=2;
    c=a+b;
    printf("ok"+a);
}

using gcc or g++ compile, there is no error, but no output, i expect the result that is "ok7", why not?
发表于 2004-3-11 16:34:21 | 显示全部楼层
printf("ok%d",c);
 楼主| 发表于 2004-3-11 16:47:02 | 显示全部楼层
i do that, but there is not a output all the same.
 楼主| 发表于 2004-3-11 16:53:52 | 显示全部楼层
I know "gcc" is compile order, is it also the running order? if there is running order to run the *.out file to show the output.
发表于 2004-3-11 17:06:16 | 显示全部楼层
楼上的,我英文不很好不知道有没有看错意思哈
gcc是编译命令
比如要编译test.c文件
gcc test.c -o test
输出文件是test
在目录下应该看到test这个文件
然后./test
就可以了
发表于 2004-3-11 18:49:16 | 显示全部楼层

printf(&quot;ok%d&quot;,a);

...
发表于 2004-3-11 19:21:02 | 显示全部楼层
iostream.h under the this is directory:
/usr/include/g++-3/
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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