c++ - How can i say visual studio to link a library with my project? -
i want write network program in visual studio, write little programm
#include<iostream> #include <winsock.h> int main() { wsadata wsadata; // if doesn't work //wsadata wsadata; // try instead // makeword(1,1) winsock 1.1, makeword(2,0) winsock 2.0: if (wsastartup(makeword(2,0), &wsadata) != 0) { std::cout << "error" << std::endl; exit(1); } wsacleanup(); return 0; }
but there link errors, in beej's guide seys should link wsock32.lib library, don't know visual studio good, can me?
add wsock32.lib text field in project properties -> linker -> input -> additional dependencies
check project properties -> linker -> command line
verify it's added command line.
alternatively, drag , drop lib file project in visual studio - should linked automatically.
Comments
Post a Comment