Winsock
-
Hi: I am building a client program in VC++ 6.0 using WINSOCK to connect to the server. I have a very small program that testing WINSOCK. My program contains include statement for WINSOCK2.h. Here is the code to initialize WINSOCK. WSADATA wsaData; int iResult; iResult = WSAStartup(0x0202, &wsaData); if (iResult != 0) { printf("WSAStartup failed: %d\n", iResult); } Errors: Linking... testwin1Dlg.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8 Debug/testwin1.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. testwin1.exe - 2 error(s), 0 warning(s) Additional Comment: I looked in WINSOCK.H and WINSOCK2.H and both has WSAStartup. In WINSOCK.H, it was PASCAL version. In WINSOCK2.H, it was either C or C++ version. Both version has the same signature (calling argurment). Can this be an issue? if yes, how can I eliminate the PASCAL version (WINSOCK.H)? Note that, I never include WINSOCK.H. Thanks Bill
-
Hi: I am building a client program in VC++ 6.0 using WINSOCK to connect to the server. I have a very small program that testing WINSOCK. My program contains include statement for WINSOCK2.h. Here is the code to initialize WINSOCK. WSADATA wsaData; int iResult; iResult = WSAStartup(0x0202, &wsaData); if (iResult != 0) { printf("WSAStartup failed: %d\n", iResult); } Errors: Linking... testwin1Dlg.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8 Debug/testwin1.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. testwin1.exe - 2 error(s), 0 warning(s) Additional Comment: I looked in WINSOCK.H and WINSOCK2.H and both has WSAStartup. In WINSOCK.H, it was PASCAL version. In WINSOCK2.H, it was either C or C++ version. Both version has the same signature (calling argurment). Can this be an issue? if yes, how can I eliminate the PASCAL version (WINSOCK.H)? Note that, I never include WINSOCK.H. Thanks Bill
jocblack wrote:
testwin1Dlg.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
So are you linking with the correct library.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi: I am building a client program in VC++ 6.0 using WINSOCK to connect to the server. I have a very small program that testing WINSOCK. My program contains include statement for WINSOCK2.h. Here is the code to initialize WINSOCK. WSADATA wsaData; int iResult; iResult = WSAStartup(0x0202, &wsaData); if (iResult != 0) { printf("WSAStartup failed: %d\n", iResult); } Errors: Linking... testwin1Dlg.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8 Debug/testwin1.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. testwin1.exe - 2 error(s), 0 warning(s) Additional Comment: I looked in WINSOCK.H and WINSOCK2.H and both has WSAStartup. In WINSOCK.H, it was PASCAL version. In WINSOCK2.H, it was either C or C++ version. Both version has the same signature (calling argurment). Can this be an issue? if yes, how can I eliminate the PASCAL version (WINSOCK.H)? Note that, I never include WINSOCK.H. Thanks Bill
Under Additional Dependencies for your Linker, add "ws2_32.lib" I think it was. Anytime you use functions that aren't compiled from inside your solution/project you need to include the .h AND the .lib file. The only other way is to load the DLL at runtime, but I don't have experience with that. Good luck :)
-
Under Additional Dependencies for your Linker, add "ws2_32.lib" I think it was. Anytime you use functions that aren't compiled from inside your solution/project you need to include the .h AND the .lib file. The only other way is to load the DLL at runtime, but I don't have experience with that. Good luck :)