我是新手,编译出错,请帮忙~
// 1_2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <winsock2.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
WSADATA wsaData;
int Ret;
if((Ret == WSAStartup(MAKEWORD(2,2),&wsaData)) != 0)
{
printf("WSAStartup failed with error %d \n",Ret);
return;
}
if(WSACleanup() == SOCKET_ERROR)
{
printf("WSACleaup failed with error %d \n",WSAGetLastError());
}
}
出错提示:
--------------------Configuration: 1_2 - Win32 Debug--------------------
Compiling...
1_2.cpp
E:\myVc++\1_2\1_2.cpp(16) : warning C4508: 'main' : function should return a value; 'void' return type assumed
E:\myVc++\1_2\1_2.cpp(13) : warning C4700: local variable 'Ret' used without having been initialized
Linking...
1_2.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1_2.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
1_2.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
Debug/1_2.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
1_2.exe - 4 error(s), 2 warning(s)