I'm compiling a project that uses pthreads with gcc (g++ exactly) on cygwin. Seeing as how I have always developed this on linux, I never had any problems.
But right now, I am unable to compile code that uses some pthread functions with the compiler complaining that these functions are not declared. I realized that the pthread.h that came with my toolchain, g++ (GCC) 5.4.0, has guarded sections with
#if __POSIX_VISIBLE >= 200112
and these are preventing functions from being available on cygwin/windows.
I attempted searching "__POSIX_VISIBLE" but did not find anything really helpful. What does this actually do and why? I assume it's just that some parts of pthread can't work on windows, or within cygwin or whatever. But why would only some of pthread be blocked under this anyway? It doesn't even complain about -pthread
being used.
I plan on changing all the pthread stuff to c++ threads eventually, but right now I'd just like this to compile so I can work on more immediate problems. Is there any way around this if I'm doing it on cygwin/windows?
looks on /usr/include/sys/features.h
for details.
Default is _GNU_SOURCE that includes everthing.
Check if your project is restricting the definition with -std
or ansi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With