pthread library include path on visual studio code

30 views Asked by At

I use Visual Studio code on Windows, on an Ubuntu WSL compiler. I keep getting the message "cannot open source file "pthread.h"" on the pthreads library. I can compile the program and it works but I want to see what some of the functions do on the code editor when I hover over it, etc.

Error message

1

There are 1 answers

0
greg spears On

Syntax for including a local non-compiler-library include file in the current project directory:

#include "pthread.h"

Similarly, the syntax for including non-compiler-library include files in a distant directory (in unix, replace back (\) slashes with forward (/) slashes):

#include "C:\path\to\my\file\pthread.h"

Syntax reserved for include files that are part of the compiler's library directory:

#include <pthread.h>

One of these syntax methods should resolve the issue.