hey everyone, and Merry Xmas!
I'm working on learning multitreading in linux and having some troubles here.
here's my code....
void* ServerThread(void*);
int main(int argc, char *argv[])
{
pthread_t thread_id;
printf("Chat Server\n");
// This will start the server thread...
pthread_create(&thread_id, NULL, &ServerThread, NULL);
return 0;
}
void* ServerThread(void* data)
{
int count = 100;
while(count != 0)
{
printf("Thread Test\n");
--count;
}
return NULL;
}
and when I compile this there are no errors... however, it's when I try to link it that there are problems.. I use Kdevelop for this. I know I have to tell it to use the right library, and I think I do..... I went to the project options and added "-lpthread" to the linker options. However I get the error:
cd '/root/Desktop/michael/programming/Linux/server/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k -j1
linking server (libtool)
linking server (g++)
/root/Desktop/michael/programming/Linux/server/src/server.cpp:13: undefined reference to `pthread_create'
*** Exited with status: 2 ***
cd '/root/Desktop/michael/programming/Linux/server/debug' && CXXFLAGS="-O0 -g3 -lpthread" "/root/Desktop/michael/programming/Linux/server/configure" --enable-debug=full -lpthread
configure: error: unrecognized option: -lpthread
Try `/root/Desktop/michael/programming/Linux/server/configure --help' for more information.
*** Exited with status: 1 ***
So, anyone out there able to help me out? I did check in my /usr/lib dir, and I do have the proper lib file....
Anyway....
Thanks for your help guys...
Mike
Michael RhodesTiger Studios Web Designhttp://tigerstudios.net