September 5th, 2003, 04:50 PM
Linkage/redifinition errors. Winsock2.h
Ok, I kind of fixed it, I have a lot of headers/source files, the only errors I get now are errors for every winsock function. I do include winsock2.h in a lot of the headers, but I have directives that don't allow me to keep including the same file (#ifndef..#endif..etc). Where can the problem be?
C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2068): error C2375: 'socket' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinSock2.h(2466): error C2375: 'WSAAsyncGetHostByName' : redefinition; different linkage
September 5th, 2003, 05:03 PM
in your main, you should first include winsock, then after it has been included you include all the files that need to use winsock. that way you only need to include it once. at least in gcc that is how i do it, someone please smack me if that's incorrect for MSVS.net
September 5th, 2003, 05:11 PM
yeah but if I include it for every file, it shouldn't matter because _WINSOCK2_API_ is defined already, am I correct?
I "fixed" the problem, for now. I compiled each file alone, and when I got to 1 file, it didn't compile, also whenever I tried to view this file in MSVC's IDE, it was viewing with the binary viewer, not ascii, I removed the file and reMade a new file from within mscv (I originally made the files using notepad), and pasted everything.
Anyway that had nothing to do with the problem I think, I was including shellapi.h.. and after commenting this out, it worked. No warnings/errors. I don't know what's wrong with shellapi.h, I am linking shell32.lib..