Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SCO OpenServer thread

Status
Not open for further replies.

allidsarechosen

Programmer
Dec 18, 2001
1
IN
Hi,
I have faced a problem when tried to run a small thread program in Sco OpenServer 5.0.6

I have installed FSUpthreads 3.5 and Pth1.4.0

The sample program is:
/* sampth.c */
#include <pthread.h>
#include <math.h>

void thread()
{
printf(&quot;I am subthread\n&quot;);
}

main()
{
pthread_t sub;

pthread_create(&sub,NULL,thread,NULL);

printf(&quot;I am main thread\n&quot;);
}


--------------------------
cc sampth.c -lgthreads
&quot;sampth.c&quot;, line 13: warning: argument is incompatible with prototype: arg #3
undefined first referenced
symbol in file
pthread_create sampth.o
i386ld fatal: Symbol referencing errors. No output written to a.out

and tried with :

cc sampth.c -lpth -L/usr/local/lib/pth
&quot;sampth.c&quot;, line 13: warning: argument is incompatible with prototype: arg #3
undefined first referenced
symbol in file
pthread_create sampth.o
i386ld fatal: Symbol referencing errors. No output written to a.out

Even though the libraries (gthreads and pth, pthread) are present, the program is not linked.

Can anyone help ?

Thanks.

Regards,
Cool
 
i have met the same problem,but now i overcome it!
i found that cc or CC is too poor to compile the programs with multithread.
when i use gcc,it helps me to compile my test programs!
so you can try it!
 
sorry for i forget another strange thing.
look the following too lines

gcc -lgthreads test.c -ot1
gcc -lgthreads test.c -ot2 -L /usr/lib

tow command can pass.but only the second command can run.
i don't know why. can anybody explian it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top