Results 1 to 3 of 3
I'm using PCLinuxOS 2007 with what is I believe the default gcc that came with it:
$ gcc --version
gcc (GCC) 4.1.1 20060724 (prerelease) (4.1.1-4pclos2007)
I have a program that ...
- 11-07-2007 #1Just Joined!
- Join Date
- Nov 2007
- Posts
- 5
need C Pthreads Library, on PCLinuxOS or in general
I'm using PCLinuxOS 2007 with what is I believe the default gcc that came with it:
$ gcc --version
gcc (GCC) 4.1.1 20060724 (prerelease) (4.1.1-4pclos2007)
I have a program that uses pthreads (POSIX Threads). It compiles so apparently the headers are there, but it doesn't link:
(.text+0xa43): undefined reference to `pthread_create'
(.text+0x82e): undefined reference to `pthread_mutex_trylock'
(.text+0x975): undefined reference to `pthread_kill'
<etc>
Where can I find the pthreads library? I found a number of web pages that give tutorials on using pthreads, but none that tells where I can find the library itself. One web page I found said that it should be in libc, but apparently it is not in the one on my system.
PCLinuxOS has a "Synaptic Package Manager" to install a lot of software without having to compile it manually. If anyone knows of a package I can install which will give me pthreads, please suggest. If not, I'm willing to compile / install it manually if need be. Any help will be appreciated!
- 11-07-2007 #2
Did you provide the -lpthread option on the command line?
Flies of a particular kind, i.e. time-flies, are fond of an arrow.
Registered Linux User #408794
- 11-07-2007 #3Just Joined!
- Join Date
- Nov 2007
- Posts
- 5
No I wasn't, and adding that fixed the problem.
Out of curiosity -
I was compiling a program with an included makefile. The -lpthread linker option was not in the makefile, but this is supposed to have built on another system. Do different versions of gcc have this set as a default linker option? Is this something that is configurable when gcc is installed?


Reply With Quote