严弘哲:C语言题请教
来源:百度文库 编辑:中科新闻网 时间:2024/05/16 19:23:49
/*Demonstrates unary operatoot prefix and postfix modes*/
#include <stdio.h>
int a, b;
int main(void)
{
/*set a and b both equal to 1 */
a = b = 1;
/* Print them,decrementing each time.*/
/* Use prefix mode for b,prefix mode for a */
Printf("\nPost Pre");
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
return 0;
}
这个程序有错吗?为什么我保存了后在没有看到程序,而是弹出了一个对话框显示内容如下:
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x40):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x68):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x90):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0xb8):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0xe0):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x108):456.c: more undefined references to `Printf' follow
_________________________________________________________________
这个程序输出是: Post Per
1 2
2 3
3 4
4 5
5 6
对吗?
#include <stdio.h>
int a, b;
int main(void)
{
/*set a and b both equal to 1 */
a = b = 1;
/* Print them,decrementing each time.*/
/* Use prefix mode for b,prefix mode for a */
Printf("\nPost Pre");
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
Printf("\n%d %d", a++, ++b);
return 0;
}
这个程序有错吗?为什么我保存了后在没有看到程序,而是弹出了一个对话框显示内容如下:
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x40):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x68):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x90):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0xb8):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0xe0):456.c: undefined reference to `Printf'
C:\DOCUME~1\mly\LOCALS~1\Temp\ccwZcaaa.o(.text+0x108):456.c: more undefined references to `Printf' follow
_________________________________________________________________
这个程序输出是: Post Per
1 2
2 3
3 4
4 5
5 6
对吗?
Printf改成printf.C语言区分大小写
你用什么环境?
看一下路径设置对了吗,如果设置不对,找不到头文件。
printf小写
C语言区分大小写.