I am trying to compile a single c++ source file test.cpp, which has a very simple code which demonstrates pthread_create(); pthread_cond_signal/pthread_cond_wait() functiona
You need to specify the library on the gcc/g++ command line after the files that depend on the library. So try:
g++ -IC:/MinGW/include/ test.cpp -lpthread
I kicked myself when I stumbled on the answer (it's kind of a FAQ for libraries and gcc). For most gcc options order doesn't matter, but for libraries it's critical.
You should not have to specify the library path if the pthread library came with your MinGW distribution (as it seems is the case for you). Also, remember that the command line above will produce an a.exe
executable; pass -o test.exe
to avoid that.