Below is the source file and make file I 'm using. while building I'm getting the below error in the console. From the error its evident that its unable to find function definition .Can anybody help me to fix this.

Console output:-
**** Build of configuration Debug for project Threading ****

make -k all
Building file: ../Threading01.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Threading01.d" -MT"Threading01.d" -o"Threading01.o" "../Threading01.cpp"
Finished building: ../Threading01.cpp

Building target: Threading.exe
Invoking: GCC C++ Linker
g++ -o"Threading.exe" ./Threading01.o
./Threading01.o: In function `main':
D:\z_sdk\Threading\Debug/../Threading01.cpp:28: undefined reference to `_imp__pthread_create'
D:\z_sdk\Threading\Debug/../Threading01.cpp:38: undefined reference to `_imp__pthread_join'
collect2: ld returned 1 exit status
make: *** [Threading.exe] Error 1
make: Target `all' not remade because of errors.
Build complete for project Threading

My Code:-

#include <pthread.h>
#include <stdio.h>
//using namespace std;

void *threadFunc(void *arg)
	char *str;
	int i = 0;


	while(i < 110 )
		printf("threadFunc  says: %s\n",str);

	return NULL;

int main(void)
	pthread_t pth;	// this is our thread identifier
	int i = 0;

	pthread_create(&pth,NULL,threadFunc,(void *)"foo");
	while(i < 100)
		printf("main is running...\n");

	printf("main waiting for thread to terminate...\n");

	return 0;

Below is the make file

all:clean hello

	g++ Threading01.o -o hello
	g++ -lpthread Threading01.cpp
	rm -rf *o hello
This article has been dead for over six months. Start a new discussion instead.