0

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! :)

3
Contributors
3
Replies
6
Views
9 Years
Discussion Span
Last Post by Kjah_C++
1

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.

0

I found out that I have to include the -pthread option into my makefile flags. :)

0

I have that same problem to... I'm not really good at programming but when i run it in C-free i only '4 undefined reference error' errors.
In declared it using "int addInmate();" but when i actually used it 'addInmate();' is said "undefined reference to 'addInmate(void)'.

Can someone help me please!!
its for an assignment i'm doing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.