#include <stdio.h>
struct d
{
int b;
}
main()
{
int i;
struct d a[2];
for(i=0;i<2;i++)
{
scanf("%d",&a[i].b);
}
getch();
}
1>------ 已启动生成: 项目: 10080220.c, 配置: Debug Win32 ------
1>生成启动时间为 2010/12/23 18:55:37。
1>InitializeBuildStatus:
1> 正在对“Debug\10080220.c.unsuccessfulbuild”执行 Touch 任务。
1>ClCompile:
1> 8.cpp
1>c:\users\jiyuan\documents\我的文档\文件\10080220.c\10080220.c\8.cpp(12): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(304) : 参见“scanf”的声明
1>c:\users\jiyuan\documents\我的文档\文件\10080220.c\10080220.c\8.cpp(14): warning C4013: “getch”未定义;假设外部返回 int
1>ManifestResourceCompile:
1> 所有输出均为最新。
1>8.obj : error LNK2005: _main 已经在 1.obj 中定义
1>C:\Users\jiyuan\Documents\我的文档\文件\10080220.c\Debug\10080220.c.exe : fatal error LNK1169: 找到一个或多个多重定义的符号
1>
1>生成失败。
1>
1>已用时间 00:00:00.77
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
scanf("%d",&a[i].b);--------------------不是赋值语句吗???
我加了 ; 了,还有#include<conio.h>,但还是报同样的错!!!
哎,悲剧啊!!!