运行一个简单的扑克出现问题 问问各位vc经验高手
#include <stdio.h>#include <stdlib.h>
#include <time.h>
#define MAXSTACK 100
int stack[MAXSTACK];
int top = -1;
int push( int value )
{
if ( top >= MAXSTACK )
{
printf("栈内容全满\n");
return -1;
}
top++;
stack[top] = value;
return 0;
}
int pop()
{
int temp;
if ( top < 0 )
{
printf("栈内容是空的\n");
return -1;
}
temp = stack[top];
top--;
return temp;
}
void mian()
{
int card[52];
int pos;
int i;
int temp;
long temptime;
srand ( time ( &temptime ) % 60 );
for ( i = 0; i < 52; i++)
card[i] = 0;
i = 0;
while ( i != 52 )
{
pos = rand() % 52;
if ( card[pos] == 0 )
{
push(pos);
card[pos] = 1;
i++;
}
}
printf(" 1 2 3 4 \n");
printf("========================\n");
for ( i = 0; i < 5; i++ )
{
temp = pop();
printf(" [%c%2d] ", temp / 13 + 3, temp % 13 + 1);
temp = pop();
printf(" [%c%2d] ", temp / 13 + 3, temp % 13 + 1);
temp = pop();
printf(" [%c%2d] ", temp / 13 + 3, temp % 13 + 1);
temp = pop();
printf(" [%c%2d] ", temp / 13 + 3, temp % 13 + 1);
printf("\n");
}
}
以上为简单的扑克游戏~
当运行时,编译器提示:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/一个简单的扑克游戏.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
这样的错误,在网上找了相关资料与找到解决方法:
Console子系统设置错误, 提示:
Windows子系统设置错误, 提示: )WA5FzPLw
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Windows项目要使用Windows子系统, 而不是Console, 可以这样设置:
[Project] --> [Settings] --> 选择"Link"属性页,
在Project Options中将/subsystem:console改成/subsystem:windows
修改后,但编译器还是出现错误:
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/一个简单的扑克游戏.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
于是再上网找到解决方法:
Console子系统设置错误, 提示: vwK 7b0M
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 控制台项目要使用Console子系统, 而不是Windows, 设置:
[Project] --> [Settings] --> 选择"Link"属性页, WveN']q\
在Project Options中将/subsystem:windows改成/subsystem:console
好像无论怎么改都会出现这俩种问题,想想问问各位vc经验高手有遇过这种情况吗??
怎么解决???~~~~