getting the undefined reference error
Hello there. What is usually the reason of getting an undefined reference error?
I have already included the pthread.h header file yet I'm still getting the undefined reference error for the pthread_create() function. *sigh*. I'm using makefile in compiling my code. Is there someone here who could enlighten me? Thanks! :)
jaepi
Practically a Master Poster
647 posts since Jul 2006
Reputation Points: 32
Solved Threads: 4
The usual reason is that you are not including the library that provides the implementation of pthread_create() . Check the documentation for pthread_create() and find out the required library. Then check if that library is in the makefile's libraries section.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
I found out that I have to include the -pthread option into my makefile flags. :)
jaepi
Practically a Master Poster
647 posts since Jul 2006
Reputation Points: 32
Solved Threads: 4