|
小弟写了个程序想验证一下,但总是有这种错误
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
void task(int *counter)
{
fprintf(stderr,"task runing\n");
}
int arg;
static pthread_t tid;
int main()
{
int ret=pthread_create(&tid,NULL,task,(void*)&arg);
if(ret)
{
fprintf(stderr,"success\n");
}
}
[root@localhost testdir]# gcc main.c -o main
main.c: In function `main':
main.c:15: warning: passing arg 3 of `pthread_create' from incompatible pointer
type
/tmp/cc67xs1l.o(.text+0x40): In function `main':
: undefined reference to `pthread_create'
collect2: ld returned 1 exit status
那位兄弟能给我解释一下,多谢了 |
|