【发布时间】:2022-01-25 00:45:16
【问题描述】:
我正在尝试包含:#include
此外,我应该如何使用 clion 中的线程? 有什么我应该做的吗?
【问题讨论】:
-
Windows 是否有
hetdb.h?我不这么认为......见这里:stackoverflow.com/questions/65206157/…
我正在尝试包含:#include
此外,我应该如何使用 clion 中的线程? 有什么我应该做的吗?
【问题讨论】:
hetdb.h?我不这么认为......见这里:stackoverflow.com/questions/65206157/…
您需要一组不同的 Windows 标头。您需要您的代码来调整差异:
#if defined(_WIN32) || defined(_WIN64) || defined(WIN32)
/* Windows headers */
#include <windows.h>
#include <io.h>
#include <processthreadsapi.h>
#include <sysinfoapi.h>
#include <time.h>
#include <winsock2.h>
#else /* or check here for unix / linux & fail if OS unrecognized */
/* POSIX headers */
#include <netdb.h>
#include <poll.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/un.h>
#include <unistd.h>
#endif /* _WIN32 */
/* shared headers */
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
当然,您可能不需要我列出的所有标题,或者您可能需要其他标题,因此请根据需要调整代码。
此外,如果标题包含顺序在您的系统上不是问题,您可以将共享标题移到 if/else 块之外。
【讨论】: