1

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!

Cassidy
  • 3,328
  • 5
  • 39
  • 76

2 Answers2

2

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.

Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
0

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.

Lee Duhem
  • 14,695
  • 3
  • 29
  • 47