我想用visual studio编写网络程序,我写了这个小程序
#include<iostream>
#include <winsock.h>
int main()
{
WSADATA wsaData; // if this doesn't work
//WSAData wsaData; // then try this instead
// MAKEWORD(1,1) for Winsock 1.1, MAKEWORD(2,0) for Winsock 2.0:
if (WSAStartup(MAKEWORD(2,0), &wsaData) != 0)
{
std::cout << "error" << std::endl;
exit(1);
}
WSACleanup();
return 0;
}
但是有链接错误,在 beej 的指南中我应该与 wsock32.lib 库链接,但我不知道 Visual Studio 好,有人可以帮助我吗?