嗨,我正在尝试编译包含libevent库的代码 .

因为util.h包含netdb.h,所以我找不到mingw-64目录中存在的库文件 . 尝试连接debian netdb.h,它失败了 .

在/usr/share/mingw-w64/include/event2/event.h:202:0中包含的文件中,来自../Thread_test.cpp:16:/ usr / share / mingw-w64 / include / event2 / util . h:64:19:致命错误:netdb.h:没有这样的文件或目录

#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <cstdio>
#include <cstring>
#ifdef __linux__
#include <sys/socket.h>
#include <event2/event.h>
#else
#include <winsock2.h>
#include <windows.h>
#include <event2/event.h>
#endif

我正在使用Ubuntu,下面提到的是我在编译时使用的命令行 .

x86_64-w64-mingw32-g -o thread.exe ../Thread_test.cpp -lws2_32 -levent -std = c 11 -std = gnu 11 -static-libgcc -static-libstdc -static

这方面的任何帮助都会有所帮助 .