c++/214: Compile error due to unistd.h and pthread.h

anand@toronto.circadence.com anand@toronto.circadence.com
Tue May 16 08:36:00 GMT 2000


>Number:         214
>Category:       c++
>Synopsis:       Compile error due to unistd.h and pthread.h
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 16 08:36:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     anand@toronto.circadence.com
>Release:        unknown-1.0
>Organization:
>Environment:
HP/UX
>Description:
I get an error due to including unistd.h and pthread.h in a .cpp file. Here is a small program which gives error on compiling with 'gcc'.

#include <unistd.h> 
#include <pthread.h> 
int main( void ) 
{ 
} 


The error returned is:
In file included from /usr/include/pthread.h:7,
                 from a.cpp:2,
/usr/include/sys/pthread.h:440: declaration of C function `int pthread_atfork(void (*)(), void (*)(), void (*)())' conflicts with
/usr/include/sys/unistd.h:187: previous declaration `int pthread_atfork(void (*)(...), void (*)(...), void (*)(...))' here

If I define _PTHREADS_DRAFT4 (check pthread.h), then the error is not shown but then I get the following error on using 'select' function call (not shown in this sample program)

a.cpp: In function `void RunApp()':
a.cpp:1294: passing `fd_set *' as argument 2 of `cma_select(int, int *, int *, int *, timeval *)'
*** Error exit code 1


I would appreciate if I can get an answer to this ASAP.

Thanks,

Anand Dua.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list