Hi All,,,
I am trying to do some threads on the TS-7200 i comiple the follwing
code as a test and i get this error please tell me what is wrong
because i am newbie to linux,,,
Best Regards,,,
Error :
this is the error i got
------------------------------------------------
ts7200:/home/Threads# ts7200:/home/Threads# gcc -o th
mythread.c
/tmp/ccVAjN1M.o: In function `main':
/tmp/ccVAjN1M.o(.text+0x2c): undefined reference to
`pthread_create'
collect2: ld returned 1 exit status
-------------------------------------------------
and this is the Code:
-----------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
int sucess=0;
void *function(void *ptr); //proto type
int main()
{
pthread_t thread1;
char *message1 = "Thread 1";
int iret;
pthread_create(&thread1, NULL,(void*)function,(void *)1);
//pthread_join( thread1, NULL);
sleep(5);// wait 5 second
if (sucess==0)
{
printf("Fails");
}
else
printf("Sucess");
printf("Thread 1 returns: %d\n",iret);
return 0;
}
void *function(void *ptr)
{
char my_string[500];
printf("Type something.\n");
//gets(my_string);
//printf ("You typed: %s\n", my_string);
sucess=1;
}
------------------------ Yahoo! Groups Sponsor --------------------~-->
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/CFFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|