Well I have been having some problems with getting some WSA code to compile, I am missing something but I can't figure out what it is.
(I did link the winsock32.lib into the project)
1 | #include <windows.h> |
2 | #include <winsock.h> |
3 | #include <process.h> |
4 | |
5 | class WinSock |
6 | { |
7 | public: |
8 | int Initialize(); |
9 | |
10 | private: |
11 | }; |
12 | |
13 | int WinSock::Initialize() |
14 | { |
15 | WORD VersionRequested; |
16 | WSADATA wsaData; |
17 | DWORD buffersize = 0; |
18 | |
19 | LPWSAPROTOCOL_INFO SelectedProtocol; |
20 | int NumProtocols; |
21 | |
22 | VersionRequested = MAKEWORD( 2, 0 ); |
23 | int error = WSAStartup( VersionRequested, &wsaData ); |
24 | |
25 | if( error ) |
26 | { |
27 | return 1; |
28 | } |
29 | else |
30 | { |
31 | if( LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0 ) |
32 | { |
33 | WSACleanup(); |
34 | return 1; |
35 | } |
36 | } |
37 | |
38 | NumProtocols = WSAEnumProtocols( NULL, NULL, &buffersize ); |
39 | |
40 | if(( NumProtocols != SOCKET_ERROR ) && (WSAGetLastError() != WSAENOBUFS ) ) |
41 | { |
42 | WSACleanup(); |
43 | return 1; |
44 | } |
45 | |
46 | SelectedProtocol = (LPWSAPROTOCOL_INFO) malloc(buffersize); |
47 | |
48 | if( SelectedProtocol == NULL ) |
49 | { |
50 | WSACleanup(); |
51 | return 1; |
52 | } |
53 | |
54 | int *protos = (int*) calloc(2, sizeof( int )); |
55 | |
56 | protos[0] = IPPROTO_TCP; |
57 | protos[1] = IPPROTO_UDP; |
58 | |
59 | NumProtocols = WSAEnumProtocols( protos, SelectedProtocol, &buffersize); |
60 | |
61 | free( protos ); |
62 | protos = NULL; |
63 | |
64 | free( SelectedProtocol ); SelectedProtocol = NULL; |
65 | if( NumProtocols == SOCKET_ERROR ) |
66 | { |
67 | WSACleanup(); |
68 | return 1; |
69 | } |
70 | return 0; |
71 | } |
Error 11 error C2371: 'BITMAP' : redefinition; different basic types c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\wingdi.h 541
Error 12 error C2229: struct 'tagDIBSECTION' has an illegal zero-sized array c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\wingdi.h 3793
Error 13 error C2065: 'LPWSAPROTOCOL_INFO' : undeclared identifier c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 19
Error 14 error C2146: syntax error : missing ';' before identifier 'SelectedProtocol' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 19
Error 15 error C2065: 'SelectedProtocol' : undeclared identifier c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 19
Error 16 error C3861: 'WSAEnumProtocols': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 38
Error 17 error C2146: syntax error : missing ';' before identifier 'malloc' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 46
Error 18 error C3861: 'WSAEnumProtocols': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 59
Are you including allegro.h as well? If that's the case, you should include winalleg.h right after. If not, then I don't know what's up.
Well, that seemed to have removed some of the more unexplainable error messages (or I did something else before that did that)
now I am down to these messages:
Error 11 error C2065: 'LPWSAPROTOCOL_INFO' : undeclared identifier c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 19
Error 12 error C2146: syntax error : missing ';' before identifier 'SelectedProtocol' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 19
Error 13 error C2065: 'SelectedProtocol' : undeclared identifier c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 19
Error 14 error C3861: 'WSAEnumProtocols': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 38
Error 15 error C2146: syntax error : missing ';' before identifier 'malloc' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 46
Error 16 error C3861: 'WSAEnumProtocols': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 59
Try including winsock2.h instead.
I am begining to think that I am linking this incorrectly, or that something is not propperly setup somewere.
This is my command line...
/OUT:"C:\Documents and Settings\Fredrik.LAPTOP\My Documents\Visual Studio 2005\Projects\SpaceFight\Debug\SpaceFight.exe" /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTFILE:"Debug\SpaceFight.exe.intermediate.manifest" /DEBUG /ASSEMBLYDEBUG /PDB:"c:\Documents and Settings\Fredrik.LAPTOP\My Documents\Visual Studio 2005\Projects\SpaceFight\debug\SpaceFight.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib comdlg32.lib ole32.lib winmm.lib alld_s.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
with winsock2.h I get errors as:
Error 11 error C2011: 'fd_set' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 112
Error 13 error C2011: 'timeval' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 156
Error 14 error C2011: 'hostent' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 212
... and so on, there are 69 of them
First include winsock2.h, then include allegro.h, finally include winalleg.h. See if that works.
ok, I get the following errors now:
Error 3 error C2371: 'BITMAP' : redefinition; different basic types c:\program files\microsoft visual studio 8\vc\include\allegro\system.h 31
Error 12 error C2731: 'WinMain' : function cannot be overloaded c:\program files\microsoft visual studio 8\vc\include\allegro\platform\alwin.h 49
Error 13 error C2733: second C linkage of overloaded function 'WinMain' not allowed c:\program files\microsoft visual studio 8\vc\include\allegro\platform\alwin.h 49
allegro.h then winalleg.h then winsock.h then winsock2.h
I am back to my 69 errors in post 3
1 | Error 11 error C2011: 'fd_set' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 112 |
2 | Error 13 error C2011: 'timeval' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 156 |
3 | Error 14 error C2011: 'hostent' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 212 |
4 | Error 15 error C2011: 'netent' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 225 |
5 | Error 16 error C2011: 'servent' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 232 |
6 | Error 17 error C2011: 'protoent' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 244 |
7 | Error 18 error C2011: 'sockaddr_in' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 400 |
8 | Error 19 error C2011: 'WSAData' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 410 |
9 | Error 23 error C2011: 'sockaddr' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 561 |
10 | Error 24 error C2011: 'sockproto' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 601 |
11 | Error 25 error C2011: 'linger' : 'struct' type redefinition c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 640 |
12 | Error 33 error C2375: 'accept' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1626 |
13 | Error 34 error C2375: 'bind' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1647 |
14 | Error 35 error C2375: 'closesocket' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1666 |
15 | Error 36 error C2375: 'connect' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1685 |
16 | Error 37 error C2375: 'ioctlsocket' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1706 |
17 | Error 38 error C2375: 'getpeername' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1727 |
18 | Error 39 error C2375: 'getsockname' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1748 |
19 | Error 40 error C2375: 'getsockopt' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1771 |
20 | Error 41 error C2375: 'htonl' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1792 |
21 | Error 42 error C2375: 'htons' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1809 |
22 | Error 43 error C2375: 'inet_addr' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1826 |
23 | Error 44 error C2375: 'inet_ntoa' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1843 |
24 | Error 45 error C2375: 'listen' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1861 |
25 | Error 46 error C2375: 'ntohl' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1879 |
26 | Error 47 error C2375: 'ntohs' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1896 |
27 | Error 48 error C2375: 'recv' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1916 |
28 | Error 49 error C2375: 'recvfrom' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1941 |
29 | Error 50 error C2375: 'select' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1967 |
30 | Error 51 error C2375: 'send' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 1991 |
31 | Error 52 error C2375: 'sendto' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2016 |
32 | Error 53 error C2375: 'setsockopt' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2042 |
33 | Error 54 error C2375: 'shutdown' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2064 |
34 | Error 55 error C2375: 'socket' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2084 |
35 | Error 56 error C2375: 'gethostbyaddr' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2107 |
36 | Error 57 error C2375: 'gethostbyname' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2126 |
37 | Error 58 error C2375: 'gethostname' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2144 |
38 | Error 59 error C2375: 'getservbyport' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2163 |
39 | Error 60 error C2375: 'getservbyname' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2182 |
40 | Error 61 error C2375: 'getprotobynumber' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2200 |
41 | Error 62 error C2375: 'getprotobyname' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2217 |
42 | Error 63 error C2375: 'WSAStartup' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2237 |
43 | Error 64 error C2375: 'WSACleanup' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2255 |
44 | Error 65 error C2375: 'WSASetLastError' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2272 |
45 | Error 66 error C2375: 'WSAGetLastError' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2289 |
46 | Error 67 error C2375: 'WSAIsBlocking' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2306 |
47 | Error 68 error C2375: 'WSAUnhookBlockingHook' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2323 |
48 | Error 69 error C2375: 'WSASetBlockingHook' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2340 |
49 | Error 70 error C2375: 'WSACancelBlockingCall' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2357 |
50 | Error 71 error C2375: 'WSAAsyncGetServByName' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2379 |
51 | Error 72 error C2375: 'WSAAsyncGetServByPort' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2406 |
52 | Error 73 error C2375: 'WSAAsyncGetProtoByName' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2432 |
53 | Error 74 error C2375: 'WSAAsyncGetProtoByNumber' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2457 |
54 | Error 75 error C2375: 'WSAAsyncGetHostByName' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2482 |
55 | Error 76 error C2375: 'WSAAsyncGetHostByAddr' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2509 |
56 | Error 77 error C2375: 'WSACancelAsyncRequest' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2532 |
57 | Error 78 error C2375: 'WSAAsyncSelect' : redefinition; different linkage c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h 2552 |
58 | Error 79 error C2079: 'wsaData' uses undefined struct 'WSAData' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 18 |
59 | Error 80 error C3861: 'WSAStartup': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 25 |
60 | Error 81 error C2440: 'initializing' : cannot convert from 'int (__stdcall *)(WORD,LPWSADATA)' to 'int' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 25 |
61 | Error 82 error C2228: left of '.wVersion' must have class/struct/union c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 33 |
62 | Error 83 error C2228: left of '.wVersion' must have class/struct/union c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 33 |
63 | Error 84 error C3861: 'WSACleanup': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 35 |
64 | Error 85 error C2446: '!=' : no conversion from 'long' to 'int (__stdcall *)(void)' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 42 |
65 | Error 86 error C2040: '!=' : 'int (__stdcall *)(void)' differs in levels of indirection from 'long' c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 42 |
66 | Error 87 error C3861: 'WSAGetLastError': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 42 |
67 | Error 88 error C3861: 'WSACleanup': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 44 |
68 | Error 89 error C3861: 'WSACleanup': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 52 |
69 | Error 90 error C3861: 'WSACleanup': identifier not found c:\documents and settings\fredrik.laptop\my documents\visual studio 2005\projects\spacefight\spacefight\winsock_.h 69 |
I don't think you need to include both winsock.h and winsock2.h. I have an Allegro program that uses WinSock, and this is the order I use: allegro.h, winalleg.h, winsock2.h.
That's what I thought, winsock2 gives me those 69 errors, winsock gives me the 6 errors in my first post.
Try getting rid of winsock.h? It seems a lot of redefinitions, either winsock and winsock2 conflict (which, IIRC, they dont), or you have a borked install of something.
try only using winsock.h or winsock2.h
then also add allegro.h and winalleg.h
then re-suffle these 3 around until you dont get any errors.
As of now I only have winsock2.h included and that is once in the entire project.
1 | #pragma once |
2 | #include <allegro.h> |
3 | #include <winalleg.h> |
4 | #include <winsock2.h> |
5 | #include <process.h> |
6 | |
7 | class WinSocket |
8 | { |
9 | public: |
10 | int Initialize(); |
11 | |
12 | }; |
13 | |
14 | int WinSocket::Initialize() |
15 | { |
16 | WORD VersionRequested; |
17 | WSADATA wsaData; |
18 | DWORD buffersize = 0; |
19 | |
20 | LPWSAPROTOCOL_INFO SelectedProtocol; |
21 | int NumProtocols; |
22 | |
23 | VersionRequested = MAKEWORD( 2, 0 ); |
24 | int error = WSAStartup( VersionRequested, &wsaData ); |
25 | |
26 | if( error ) |
27 | { |
28 | return 1; |
29 | } |
30 | else |
31 | { |
32 | if( LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0 ) |
33 | { |
34 | WSACleanup(); |
35 | return 1; |
36 | } |
37 | } |
38 | |
39 | NumProtocols = WSAEnumProtocols( NULL, NULL, &buffersize ); |
40 | |
41 | if(( NumProtocols != SOCKET_ERROR ) && (WSAGetLastError() != WSAENOBUFS ) ) |
42 | { |
43 | WSACleanup(); |
44 | return 1; |
45 | } |
46 | |
47 | SelectedProtocol = (LPWSAPROTOCOL_INFO) malloc(buffersize); |
48 | |
49 | if( SelectedProtocol == NULL ) |
50 | { |
51 | WSACleanup(); |
52 | return 1; |
53 | } |
54 | |
55 | int *protos = (int*) calloc(2, sizeof( int )); |
56 | |
57 | protos[0] = IPPROTO_TCP; |
58 | protos[1] = IPPROTO_UDP; |
59 | |
60 | NumProtocols = WSAEnumProtocols( protos, SelectedProtocol, &buffersize); |
61 | |
62 | free( protos ); |
63 | protos = NULL; |
64 | |
65 | free( SelectedProtocol ); SelectedProtocol = NULL; |
66 | if( NumProtocols == SOCKET_ERROR ) |
67 | { |
68 | WSACleanup(); |
69 | return 1; |
70 | } |
71 | return 0; |
72 | } |
[edit]
ok the "best" I can do is having them structured with winsock2 before winalleg that only generates these errors:
Error 11 error C2371: 'BITMAP' : redefinition; different basic types c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\wingdi.h 541
Error 12 error C2229: struct 'tagDIBSECTION' has an illegal zero-sized array c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\wingdi.h 3793
Have you tried not including winsock.h nor winsock2.h? The correct order is all the standard headers first, then allegro.h, then winalleg.h. Thus, your order should be process.h, winsock2.h, allegro.h, winalleg.h.
If I don't include it I get the expected errors that it cannot find any of it, if I include it in the order specified in your post I get the same errors as in my last post.
I've noticed same errors untils upgrading my mingw32 install. Upgrade man.
I used the precompiled binarys for vs 8, do I still need Mingw?
I use Allegro/Enet/WinSock with VC8. My include goes like:
1 | #include <allegro.h> |
2 | #include "main.h" |
3 | /* main.h */ |
4 | #ifdef ALLEGRO_WINDOWS |
5 | #define _WINSOCKAPI_ |
6 | #include <winalleg.h> |
7 | #endif |
8 | #include "enet/enet.h" |
9 | |
10 | /* enet/enet.h */ |
11 | #include "enet/win32.h" |
12 | |
13 | /* enet/win32.h */ |
14 | #include <stdlib.h> |
15 | #include <winsock2.h> |
I'm linking with ws2_32.lib. So I think you want:
#include <allegro.h> #define _WINSOCKAPI_ #include <winalleg.h> #include <winsock2.h>
Thank you all for the help. It compiles, without any errors now.
Excuse me, but,
what can I do with this : winsock2.h
I'm sorry but I have no documentation about....
winsock2 is backward compatible, that means all the ws1.1 codes works good with ws2 too. Just search for ws1.1 specs.
www.sockaddr.com has 1.1 and 2.0 specs