GCC 4.1.2 / glibc Pthreads requires macro defined to get 'standard' functionality

Eddy [the Obsessed] Cullen eddy@obsessedcomputers.co.uk
Tue Aug 14 18:37:00 GMT 2007


Hi,

Why can't I:

#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>

int main ()
{
	printf("Value of PTHREAD_MUTEX_RECURSIVE is: %d\n",
PTHREAD_MUTEX_RECURSIVE);
	return 0;
}

I have to define _XOPEN_SOURCE 500 or _GNU_SOURCE to get it to work

OS is SuSE 10.2 with provided version of GCC.

Man page for pthread.h does not describe this requirement in any way and
it seems just plain weird that the cross-platform / standard behaviour
is NOT available without some voodoo...

Eddy



More information about the Gcc-help mailing list