I have simplified my source like the following :
void *thread1(void *param)
{
pthread_detach(pthread_self());
while(1)
{
sleep( 3 ) ;
printf("hello world in thread1 \n");
} //while
return NULL ;
} //thread1
int main()
{
pthread_t tid ;
pthread_create(&tid , NULL, thread1, (void*)3);
while(1)
{
sleep( 3 ) ;
printf("hello world in main \n");
} //while
} // main
and compile it by :
g++ --std=c++11 -fprofile-generate xxx.cpp -pthread -o xxx.exe
in g++ 4.8.5 , execute xxx.exe can not see xxx.gcda , and then I simplified it to the following ..... only main thread !!
int main()
{
while(1)
{
sleep( 3 ) ;
printf("hello world in main \n");
} //while
} // main
and compiled by :
g++ --std=c++11 -fprofile-generate yyy.cpp -o yyy.exe
in the same compiler g++ 4.8.5 and execute , still no yyy.gcda created !!
In a simple case like above , What I missed so no gcda been created ?!