Sockets (C++)

Continues error, but i tryied to solve it.
ends like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <winsock2.h>
#include <windows.h>

WSADATA wsaData;

WORD version = MAKEWORD( 2, 0 );

int error = WSAStartup( version, &wsaData );

/* check for error */
if (error != 0)
{
    /* error occured */
return FALSE;
}

/* check for correct version */
if ( LOBYTE( wsaData.wVersion ) != 2 ||
     HIBYTE( wsaData.wVersion ) != 0 )
{
    /* incorrect WinSock version */
    WSACleanup();
    return FALSE;
}

/* WinSock has been initialized */


BUT Sends this:
[Linker Error] undefined reference to `WinMain@16'
[Build Errror] Error 1

Plz help....
Last edited on
I searrched in other forums, and i didnt find any type of help... ur my last chance in sockets.
any one plz just say hi?
hi :P
I'm not sure, I'm just starting with sockets, but it might be that u need to use a different header file.
There are some small details as to when you use winsock2.h and when u use something else.

hope that helps
where does your program start?...
Topic archived. No new replies allowed.