测试和验证.c代码:
#include <stdlib.h>
#include <stdio.h>
#include <errno.h> int main( void )
{
char *str = NULL;
int value = 0; // An example of the atoi function.
str = " -2309 ";
value = atoi( str );
printf( "Function: atoi( \"%s\" ) = %d\n", str, value ); // Another example of the atoi function.
str = "31412764";
value = atoi( str );
printf( "Function: atoi( \"%s\" ) = %d\n", str, value ); // Another example of the atoi function
// with an overflow condition occuring.
str = "3336402735171707160320";
value = atoi( str );
printf( "Function: atoi( \"%s\" ) = %d\n", str, value );
if (errno == ERANGE)
{
printf("Overflow condition occurred.\n");
}
return 1;
} --------------------Configuration: 测试和验证 - Win32 Debug--------------------
Compiling...
测试和验证.c
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/测试和验证.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.测试和验证.exe - 2 error(s), 0 warning(s)
#include <stdlib.h>
#include <stdio.h>
#include <errno.h> int main( void )
{
char *str = NULL;
int value = 0; // An example of the atoi function.
str = " -2309 ";
value = atoi( str );
printf( "Function: atoi( \"%s\" ) = %d\n", str, value ); // Another example of the atoi function.
str = "31412764";
value = atoi( str );
printf( "Function: atoi( \"%s\" ) = %d\n", str, value ); // Another example of the atoi function
// with an overflow condition occuring.
str = "3336402735171707160320";
value = atoi( str );
printf( "Function: atoi( \"%s\" ) = %d\n", str, value );
if (errno == ERANGE)
{
printf("Overflow condition occurred.\n");
}
return 1;
} --------------------Configuration: 测试和验证 - Win32 Debug--------------------
Compiling...
测试和验证.c
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/测试和验证.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.测试和验证.exe - 2 error(s), 0 warning(s)
2.进入project->setting->Link, 在Project options中将 /subsystem:windows改为/subsystem:console.
3.保存设置,Rebuild All.网上解决这个的很多,不是广告,百度一下,你就知道!