请看我这段C代码,有什么错误

[复制链接]
查看11 | 回复2 | 2009-7-10 18:12:08 | 显示全部楼层 |阅读模式
我在VC++6.0新建了一个 Win32 Applicatio,然后添加了一个C++文件,就输入了下边这段代码,代码我在CODEBLOCKS和DEVC++里编译都能通过,但是在VC++6.0里边就不行,说有一个错误,0个警告。究竟错在哪了呢?
#include
int main(void)
{
long numHe=0;//总和初始为0
long numDan;//一个变量
int status;
printf("Please enter a integer");
status=scanf("%ld",&numDan);
while(status==1)
{
numHe=numDan+numHe;
printf("Please enter next:");
status=scanf("%ld",&numDan);
}
printf("Thank you for Playing\n");
printf("All zhe integers: %ld",numHe);
return 0;
}
下边是出错信息
--------------------Configuration: forc1 - Win32 Debug--------------------
Compiling...
forc1-1-1.c
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/forc1.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
Creating browse info file...
forc1.exe - 1 error(s), 0 warning(s)

回复

使用道具 举报

千问 | 2009-7-10 18:12:08 | 显示全部楼层
%Id?...
回复

使用道具 举报

千问 | 2009-7-10 18:12:08 | 显示全部楼层
status=scanf("%ld",&numDan);用scanf("%ld",&numDan);status=numDan;试试...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行