lkml.org 
[lkml]   [2000]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
hi,
Could anyone help me out of this Thread

I tried to compile this small sample code
-------------------------------------
#include <stdio.h>
#include <pthread.h>

pthread_t a_thread;
pthread_attr_t a_thread_attribute;
void thread_function(void*argument);
char *some_argument;

int flag =0;

main();
{

pthread_create(&atherad,
&athread_attribute,
(void*)&thread_function,
(void*)&some_argument);

while(flag != 1)
;

printf("Thread1 exiting..");
}


void thread_function(void *argument)
{
int count =0;
while(count<10)
{
printf("Thread 2 is running %d",count);
}

flag =1;

printf("Thread 2 is exiting..");
}
-------------------------------------------
I tried to compile this using

gcc Sample.c

But I got some error like

/tmp/ccoocq3y.o(.text+0x18): undefined reference to 'pthread_create'
collect2 returned 1 exit status

even with -l option it is not working.

/usr/lib/libpthread.so
and
/usr/lib/libpthread.a are available.

What could be the problem here?, Could any one can suggest a way out.

thanks in advance

-bsm..
---------------------------------------------
bsmanoj@peacock.iitm.ernet.in
bsmanoj@iname.com
----------------------------------------------


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.025 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site