线程编译linux,怎么错了~谢了

2025-03-10 13:05:47
推荐回答(1个)
回答1:

这一句:
ret=pthread_create(&id2,NULL,(void*)myThread2.NULL);
逗号写成了点号,改为:
ret=pthread_create(&id2,NULL,(void*)myThread2, NULL);
编译时加链接线程库:
CC xx.c -o xx -lpthread