- 论坛徽章:
- 0
|
下面是起线程的代码:
- //启动每日处理线程
- iRet=pthread_create(&tid, NULL, &MonthlyTableProcess, (void *)(g_stpMParam[i]));
- if(iRet==0){//调用成功
- printf("succeed to create thread\n");
- sleep(1);
- }
- else{//调用失败
- printf("%d:%s\n", errno, strerror(errno));
- printf("Fail to create thread\n");
- }
复制代码
一下是调用函数的声明:
SMidtblParam和stpMP都是自定义的结构体。
- void MonthlyTableProcess(void* param)
- {
- //得到抽取的参数
- SMidtblParam* stpMP;
- stpMP=(SMidtblParam* )param;
- ………………
- }
复制代码
一下是编译错误的:
1540-5215 (W) No licenses available. Contact your program supplier to add additional users. Compilation will proceed shortly.
1540-5201 (W) Suboption "ppc64" for option "arch" is not supported on the target platform.
"workproduce.cpp", line 447.65: 1540-0256 (S) A parameter of type "extern "C" void *(*)(void *)" cannot be initialized with an expression of type "void *".
"workproduce.cpp", line 447.65: 1540-1205 (I) The error occurred while converting to parameter 3 of "pthread_create(pthread_t *, const pthread_attr_t *, extern "C" void *(*)(void *), void *)".
请问为什么会出错?正确的该怎么写? |
|