bonjour
je suis en train de regarder des tutos sur les sockets.
j'ai ecrit se code :
et sa ma met une erreur :Code:#include <iostream> #include <winsock2.h> #pragma comment(lib, "ws2_32.lib") using namespace std; int main(int argc, char *argv[]) { WSADATA WSAData; WSAStartup(MAKEWORD(2,0), &WSAData); SOCKET sock; SOCKADDR_IN sin; sin.sin_addr.s_addr = inet_addr("127.0.0.1"); sin.sin_family = AF_INET; sin.sin_port = htons(23); sock = socket(AF_INET,SOCK_STREAM,0); bind(sock, (SOCKADDR *)&sin, sizeof(sin)); connect(sock, (SOCKADDR *)&sin, sizeof(sin)); }
Code:C:\c++\serveur\main.cpp|3|warning: ignoring #pragma comment | C:\c++\serveur\main.cpp|11|undefined reference to `_WSAStartup@8'| C:\c++\serveur\main.cpp|16|undefined reference to `_inet_addr@4'| C:\c++\serveur\main.cpp|18|undefined reference to `_htons@4'| C:\c++\serveur\main.cpp|19|undefined reference to `_socket@12'| C:\c++\serveur\main.cpp|20|undefined reference to `_bind@12'| C:\c++\serveur\main.cpp|22|undefined reference to `_connect@12'| ||=== Build finished: 6 errors, 1 warnings ===|
-----