I have a C code which contains #include<synch.h>
The code compiles successfully in solaris but in Linux I find that the header is missing.
As suggested in a few links, can "sync.h"
be used instead?
Or is there any other equivalent header for synch.h in Linux?
Asked
Active
Viewed 2,472 times
2

Blackforest
- 1,009
- 2
- 11
- 18
-
It would useful to know what sync.h does for you .. is it part of a another project? Is it an OS header? – Spaceghost May 18 '12 at 13:25
-
Hi Spaceghost, it is an OS header. – Blackforest May 18 '12 at 13:47
-
What does that provide? It is hard to identify if there is an equivalent based on name alone. – Spaceghost May 18 '12 at 14:36
2 Answers
4
The synch.h header in Solaris is for Solaris threads. Among other things, it provides declarations for semaphores and mutexes. You can either this library (http://sctl.sourceforge.net/sctl_v1.1_rn.html) to give you Solaris compatible threading on Linux or, a much better idea, rework your code to use POSIX threading.

Spaceghost
- 6,835
- 3
- 28
- 42
-
-
May get "undefined reference to symbol 'pthread_create@@GLIBC_XXX", solve by including '-lpthread' as a compiler flag. --> https://stackoverflow.com/q/34143265/8960744 – Mona Wade Feb 08 '21 at 16:50
1
We can't be sure, but one likely possibility is that this is the synch.h
that's part of NACHOS, which is often used in educational environments. Head over to the NACHOS project page and read up on it, and decide whether you think that's probably the right thing; if so, you can download and install it for free.

Ernest Friedman-Hill
- 80,601
- 10
- 150
- 186