I am doing a cross compilation test in Eclipse IDE for meta-toolchain made with Yocto, for arm cortex A9 processor. After performing hello world test, which ran successfully, I created a basic program to test pthreads.
    #include <iostream>
    #include <string.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <fcntl.h>
    #include <time.h>
    #include <pthread.h>
    #define MILLION 1000000         /* one million = 10^6*/
    #define sec_to_nsec 1000000000  /* ns to s conversion = 10^9 */
    #define FILENAME "Schd.txt"
    #define FLUSH_TIME 10.0
    #define SIG_LLP_TIMER       SIGRTMIN+1
    int     isr_idx;            /* counter of ISR occurred -- starts from 0 and increments at each interrupt*/
    volatile float  clk_k,              /* MY_CLOCK() value for the current sample*/
            clk_k_1;            /* MY_CLOCK() value for the previous sample*/
    /*clock and timer values*/
    struct itimerspec custom_itimerspec;
    timer_t timer_id;
    clockid_t USED_CLK;
    struct  timespec tv;
    float a_n;
    /*THREAD DATA*/
    pthread_t thread0;
    pthread_attr_t attr;
    struct sched_param param;
    using namespace std;
    void* thread_scheduler(){
        //function pointer
        //mainThread
        //make thread for scheduling
        //exit after max cycle
    }
    int main(void) 
    {
            cout << "Starting the program!" << endl; /* prints Hello World */
            cout<< "Creating a Thread to deploy" << endl;
            int  status;
            param.__sched_priority = 99;
                int retc;
                /*PTHREAD ATTR setup*/
                retc = pthread_attr_init(&attr);
                retc |= pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
                retc |= pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
                retc |= pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
                retc |= pthread_attr_setschedparam(&attr,¶m);
                if (retc != 0) {
                    //fail
                    while(1){}
                }
                retc = pthread_create(&thread0, &attr, (void * (*)(void *))thread_scheduler, NULL);
            printf("Exiting here!");
            return 0;
    }
But I get this error, undefined reference to `pthread_create', followed with some make errors.
Though after doing some search I found that adding '-pthread' command in configure and autogen settings works for building the project, as described here. But I am puzzled why the compiler can't see these files even if this file is present in 'includes' in the drop down folder of project explorer.
 
    