I tried to use pthread_create in RedHat Linux AS4, both in Eclipse+CDT and KDevelop.
KDevelop:
When you build a project by KDevelop, you'd better add a '-pthread' to the link option if your project includes <pthread.h>. Without that option, KDevelop would report an link error : '/root/kde/oop/src/oop.c:23: undefined reference to `pthread_create'
After rebuild, the program works well.
Eclipse + CDT:
When you use pthread_create in your project, it will compile and link ok. But when you execute the program, the thread will receive a signal SIGSEGV that said: Execution is suspended because of error. Cannot find bounds of current function
I tried to add '-pthread' to the link option of the Eclipse CDT, but it's helpless. I don't know how to correct this.
KDevelop:
When you build a project by KDevelop, you'd better add a '-pthread' to the link option if your project includes <pthread.h>. Without that option, KDevelop would report an link error : '/root/kde/oop/src/oop.c:23: undefined reference to `pthread_create'
After rebuild, the program works well.
Eclipse + CDT:
When you use pthread_create in your project, it will compile and link ok. But when you execute the program, the thread will receive a signal SIGSEGV that said: Execution is suspended because of error. Cannot find bounds of current function
I tried to add '-pthread' to the link option of the Eclipse CDT, but it's helpless. I don't know how to correct this.
博主在RedHat Linux AS4系统中,分别使用Eclipse+CDT和KDevelop调用pthread_create函数。使用KDevelop时,项目包含<pthread.h>需在链接选项添加'-pthread',否则会报链接错误;使用Eclipse+CDT时,编译链接正常,但执行程序线程会收到SIGSEGV信号,添加'-pthread'也无法解决。
949

被折叠的 条评论
为什么被折叠?



