User compiling with the OS390 2.10 compiler started to receive syntax errors in pthread.h.
The following error messages were received during the compile.
"CEE.SCEEH.H(PTHREAD)", line 242.53: CBC1090(S) Syntax error - expected "expression" and found ")". "CEE.SCEEH.H(PTHREAD)", line 243.60: CBC1090(S) Syntax error - expected "expression" and found ")".
"CEE.SCEEH.H(PTHREAD)", line 248.31: CBC1013(S) Identifier "pthread_t" is undefined. .... etc.
In Addition: Using z/OS C/C++ Compile a CCN5827 error was reported in limits.h when system header files were included prior to define for _OPEN_THREADS
The cause of the problem was the location of the define for _OPEN_THREADS needed for pthread. Its #define must be first.
Resolving the problem
Move the #define _OPEN_THREADS to the top of the source program or use the compiler option DEF(_OPEN_THREADS). Defines such as these are best placed ahead of any include files used by the application. Note that a similar problem may be seen on releases of the compiler after OS390 2.10.0.
This rule is documented in the C/C++ Runtime Library Reference. It has a section on using Feature Test Macros and mentions using defines prior to including any header files.
|Software Development||OS/390 C/C++||z/OS||2.10|