Cassidy
Cassidy

Reputation: 3408

No such file found with semaphore.h and ucontext.h

I have my code here:

#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;

And when I try to build the project I get Error 1 error C1083: Cannot open include file: 'ucontext.h': No such file or directory (and also for semaphore.h).

Why is this? How do I fix it? Does it have to do with the fact that I have a Windows machine?

Thank you!

Upvotes: 1

Views: 12828

Answers (2)

Lee Duhem
Lee Duhem

Reputation: 15121

Suppose you have semaphore.h and/or ucontext.h in /path/to/dir, you could add option -I/path/to/dir to gcc to fix this problem.

By the way, semaphore.h and ucontex.h are parts of Glibc, with a properly installed GNU Toolchain, gcc should be able to find them without any additional options.

Upvotes: 0

Ferenc Deak
Ferenc Deak

Reputation: 35408

ucontext.h and semaphore.h are part of the linux-headers linux package. I don't think you'll be able to compile this application on Windows. Install a virtual machine with Linux and try to compile there.

Upvotes: 2

Related Questions