我简化了以下内容:
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
并按以下方式编译:
g++ --std=c++11 -fprofile-generate xxx.cpp -pthread -o xxx.exe
在g ++ 4.8.5中,执行xxx.exe无法看到xxx.gcda,然后我简化了 它到以下.....只有主线!!
int main()
{
while(1)
{
sleep( 3 ) ;
printf("hello world in main \n");
} //while
} // main
并编译:
g++ --std=c++11 -fprofile-generate yyy.cpp -o yyy.exe
在同一个编译器g ++ 4.8.5中执行,仍然没有创建yyy.gcda !!
在上面这样的简单案例中,我错过了什么,所以没有创建gcda?!