gpt4 book ai didi

c - 使用 semaphore.h 和 ucontext.h 找不到这样的文件

转载 作者:太空宇宙 更新时间:2023-11-04 02:50:29 26 4
gpt4 key购买 nike

我的代码在这里:

#define _GNU_SOURCE

#include "lib-ult.h"

#include <stdio.h>
#include <stdlib.h>

#include <ucontext.h>
#include <semaphore.h>

#define TRUE 1
#define FALSE 0
#define FAILURE -1

typedef struct Node {
ucontext_t* context;
int priority;

struct Node* next;
struct Node* prev;
} Node;

int STACK_SIZE = 16384;

sem_t queueLock;

sem_t threadsLock;

当我尝试构建项目时,我得到了 Error 1 error C1083: Cannot open include file: 'ucontext.h': No such file or directory(还有 semaphore.h)。

这是为什么?我如何解决它?这与我拥有 Windows 计算机这一事实有关吗?

谢谢!

最佳答案

ucontext.hsemaphore.hlinux-headers linux 包的一部分。我认为您无法在 Windows 上编译此应用程序。安装带有 Linux 的虚拟机并尝试在那里编译。

关于c - 使用 semaphore.h 和 ucontext.h 找不到这样的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22654679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com