public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Help : Threads in AIX
       [not found] <659C31367235D511A89C00B0D0AB5C3F03B68CCC@CTSINCSISXUA>
@ 2002-08-17  8:59 ` David Edelsohn
  0 siblings, 0 replies; only message in thread
From: David Edelsohn @ 2002-08-17  8:59 UTC (permalink / raw)
  To: Swaminathan, Sangeetha (Cognizant); +Cc: gcc-help

>>>>> Swaminathan, Sangeetha (Cognizant) writes:

> I have  CDoc.h and CDoc.C.
> My CDoc.h has #include<pthread.h>, and a member variable pthread_mutex_t
> mutex;
> 
> In CDoc.C,
> The constructor has pthread_mutex_init(&mutex, NULL);
> and MyFunction() calls: pthread_mutex_lock (&mutex); and
> pthread_mutex_unlock(&mutex);
> and the destructor calls pthread_mutex_destroy(&mutex);
> 
> I am able to compile CDoc.C and generate a CDoc.o
> But when I create a libCDoc.so (a shared object) from the CDoc.o, I get
> these errors:
> 
> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init
> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock
> ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock
> 
> However, in another case: Main.h and Main.C where I don't define any
> classes (I used the other classes already defined):
> I create threads, and use the above thread functions as well. I don't get
> the error. But I don't builb a .so also.
> 
> What could be the problem??

	Are you compiling your pthread program with

gcc -pthread ?

	You do not say which version of GCC you are using.  There was a
problem with GCC 3.0 sometimes creating a dependency on libpthread because
of a G++ header file problem.  Upgrade GCC to GCC 3.1.1 or GCC 3.2 to fix
this. 

David

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-17 15:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <659C31367235D511A89C00B0D0AB5C3F03B68CCC@CTSINCSISXUA>
2002-08-17  8:59 ` Help : Threads in AIX David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).