[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[LI] Threads



For all those who use pthreads instead of clone,
does gcc compilation for pthread need and extra library ??
This does not work with me ..

<snip-->
#include <pthread.h>
void * thr(void * x)
{
    printf("Thread\n");
}

int main()
{
    pthread_t t;
    pthread_create (&t,NULL,thr,NULL);
    while (1) {
        printf("Main\n");
    }
}

<--snip>

The error is a linker error : collect2 :ld returned exit status 1
Apparently it cannot find reference to pthread_create()

thanks in Advance
_______________________________________________
Shourya Sarcar
Student
Department of Computer Science and Engineering
Jadavpur University
Calcutta
India 700032

Email :  sarcar@xxxxxxxx
Phone:  91-33-4710477
Residence : 364/3 Netaji Subhas Chandra Bose Road
                            Calcutta , India 700 047
_______________________________________________

--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.