First, the summary
Libevent is a lightweight, open source high-performance event notification library written in C.
In the Libevent official website (http://libevent.org) Download the source package, in the Windows platform compile, will be reported missing "Print_winsock_errors.obj" error.
Second, reason and solution
checked, this is because the file is missing from the source package TEST/PRINT_WINSOCK_ERRORS.C caused, the cause is unknown.
workaround: Generate Manually TEST/PRINT_WINSOCK_ERRORS.C, here's what the code is searching for from git:
#include <winsock2.h>#include<windows.h>#include<stdlib.h>#include<stdio.h>#include"event2/event.h"#include"event2/util.h"#include"event2/thread.h"#defineE (x) printf (#x "\"%s\ "\ n", evutil_socket_error_to_string (x));intMain (intargcChar**argv) { intI, J; Const Char*S1, *S2, #ifdef evthread_use_windows_threads_implemented evthread_use_windows_threads ();#endifS1=evutil_socket_error_to_string (WSAEINTR); for(i =0; I <3; i++) {printf ("\niteration%d:\n\n", I); E (WSAEINTR); E (wsaeacces); E (Wsaefault); E (Wsaeinval); E (Wsaemfile); E (Wsaewouldblock); E (wsaeinprogress); E (Wsaealready); E (Wsaenotsock); E (Wsaedestaddrreq); E (wsaemsgsize); E (Wsaeprototype); E (wsaenoprotoopt); E (Wsaeprotonosupport); E (Wsaesocktnosupport); E (Wsaeopnotsupp); E (Wsaepfnosupport); E (Wsaeafnosupport); E (Wsaeaddrinuse); E (Wsaeaddrnotavail); E (Wsaenetdown); E (Wsaenetunreach); E (Wsaenetreset); E (wsaeconnaborted); E (Wsaeconnreset); E (WSAENOBUFS); E (Wsaeisconn); E (Wsaenotconn); E (Wsaeshutdown); E (wsaetimedout); E (WSAECONNREFUSED); E (Wsaehostdown); E (Wsaehostunreach); E (Wsaeproclim); E (Wsasysnotready); E (wsavernotsupported); E (wsanotinitialised); E (Wsaediscon); E (Wsatype_not_found); E (Wsahost_not_found); E (Wsatry_again); E (Wsano_recovery); E (Wsano_data); E (0xdeadbeef);/*test the case where no message is available*/ /*fill up the hash table a bit to make sure it grows properly*/ for(j =0; J < -; J + +) { interr; Evutil_secure_rng_get_bytes (&err,sizeof(err)); Evutil_socket_error_to_string (ERR); }} s2=evutil_socket_error_to_string (WSAEINTR); if(S1! =S2) printf ("Caching failed!\n"); Libevent_global_shutdown (); returnexit_success;}
Then use the VS Command prompt tool, execute under the libevent decompression directory: nmake/f Makefile.nmake, compile successfully.
Third, other
After inspection, in the official website listed 1.4.x-stable, 2.0.x-stable, 2.1.x-stable and other versions appear to have this problem.
PRINT_WINSOCK_ERRORS.C There is only one test code, and it doesn't matter much, so another workaround is to modify the Cmakefilelist and remove the print_winsock_errors-related content from it.
Resolution "Missing Print_winsock_errors.obj" is reported when Windows compiles libevent