为什么提示2个异常
为什么提示2个错误
#include<stdio.h>
void main()
{
int a,b,sum;
a=678;b=322;
sum=a+b;
printf("sum is %d\n",sum);
}
原来书上是a=123;b=456
提示 Error NONAME00.CPP 1: bad file name format in include directive
Error NONAME00.CPP 7: Function 'printf' shonld hacve a prototype
能说的明白点吗?俺是新人
------解决方案--------------------
可能是少了空格吧
#include<stdio.h>
void main()
{
int a,b,sum;
a=678;b=322;
sum=a+b;
printf("sum is %d\n",sum);
}
原来书上是a=123;b=456
提示 Error NONAME00.CPP 1: bad file name format in include directive
Error NONAME00.CPP 7: Function 'printf' shonld hacve a prototype
能说的明白点吗?俺是新人
------解决方案--------------------
可能是少了空格吧
- C/C++ code
#include <stdio.h>
------解决方案--------------------
都是include引起的,include没引入的话,自然printf找不到原型了。
------解决方案--------------------
第1个问题不是没空格.我空格了一样错误.....
------解决方案--------------------
看一下你的库文件路径是否正确吧
------解决方案--------------------
你用的什么编译器和环境啊。
------解决方案--------------------
语法上没有错误啊!是不是保存路径的问题?
------解决方案--------------------
在我这里编译没有问题 确认是你的环境问题!
------解决方案--------------------
- C/C++ code
#include <stdio.h> int main(int argc, char *argv[]) { int a,b,sum; a=678;b=322; sum=a+b; printf("sum is %d\n",sum); return 0; }
------解决方案--------------------
晕死 应该没错 啊 你是什么编译器 啊
------解决方案--------------------
你的标准库路径不对
------解决方案--------------------
楼主是不是编译器没有装好啊
------解决方案--------------------
标准答案:
#include <stdio.h>
int main(void)
{
int a,b,sum;
a=678;b=322;
sum=a+b;
printf("sum is %d\n",sum);
return 0;
}
------解决方案--------------------
有没有可能你的stdio.h的“.”写成了句号或逗号
------解决方案--------------------
我直接复制你的代码 在vc6.0下编译无误 不知道 你的怎么会错?
------解决方案--------------------
我在VC6上编译通过,结果为:
sum is 1000
------解决方案--------------------
在我这边编译运行没有任何问题。。可能是你编译器的问题。有可能没装好
------解决方案--------------------
要么就是你输入法方面弄错了;要么编译器有问题;
你再检查检查呢……
------解决方案--------------------
你的标准库路径不对吧
------解决方案--------------------
我的没错,可能你的是编译器问题!
------解决方案--------------------
你的文件扩展名是不是弄错了,
提示错误一上写着呢,Error NONAME00.CPP 1: bad file name format in include directive
------解决方案--------------------
这个真不知道为啥
------解决方案--------------------
语法上没有问题的,可能是某些细节问题,请仔细检查
或换个编译器试一下
------解决方案--------------------
再次确认,真的没编译错误。要不你保存为.cpp文件试试
------解决方案--------------------
拓展名有问题吧。。。
------解决方案--------------------