/// // Problem ///// //////////////////////////////////////// /////////////////////////
When writing C ++ socket-related programs, the following errors are encountered: (record the solution and keep a little bit of it !)
Error 2 error lnk2019: the external symbol _ imp _ wsacleanup @ 0 that cannot be parsed. This symbol is used in the function "int _ cdecl initwinsock (void )"(? Initwinsock @ yahxz) referenced in E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
Error 3 error lnk2019: the external symbol _ imp _ wsastartup @ 8 that cannot be parsed. This symbol is used in the function "int _ cdecl initwinsock (void )"(? Initwinsock @ yahxz) referenced in E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
Error 4 error lnk2019: the external symbol _ imp _ Send @ 16 that cannot be parsed is referenced in function _ main. E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
Error 5 Error lnk2019: the external symbol _ imp _ htonl @ 4 that cannot be parsed is referenced in function _ main. E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
Error 6 error lnk2019: the external symbol _ imp _ connect @ 12 that cannot be parsed. This symbol is referenced in function _ main. E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
Error 7 Error lnk2019: the external symbol _ imp _ socket @ 12 that cannot be parsed is referenced in function _ main. E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
Error 8 Error lnk2019: the external symbol _ imp _ inet_addr @ 4 that cannot be parsed. This symbol is referenced in function _ main. E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
Error 9 error lnk2019: the external symbol _ imp _ htons @ 4 that cannot be parsed is referenced in function _ main. E: \ learning program \ c ++ \ naluh264 \ naluh264 \ encoder. OBJ naluh264
\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Add a reference to the header file:
#pragma comment(lib,"ws2_32.lib")