(no subject)

From: B.S.Manoj (bsmanoj@peacock.iitm.ernet.in)
Date: Fri Mar 17 2000 - 04:37:14 EST


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/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:20 EST