【问题标题】:"conversion to non-scalar type requested" Error in this small code snippet“请求转换为非标量类型”这个小代码片段中的错误
【发布时间】:2011-05-16 07:39:02
【问题描述】:

这是我的代码 sn-p,在尝试编译此代码时,它在“tid[i] = (pthread_t) -1”行显示“转换为请求的非标量类型”错误,其中下面突出显示。如果有人知道这件事,请帮助我。

main(void)
{    
unsigned int i, repeat;
unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
void *results[MAX_ARGC];
int ret;

xmlInitParser();
for (repeat = 0;repeat < 500;repeat++) {
xmlLoadCatalog(catalog);

for (i = 0; i < num_threads; i++) {
    results[i] = NULL;
    **tid[i] = (pthread_t) -1;**  //getting error at this point
}

提前致谢,

斯里

【问题讨论】:

  • 你好像忘记给我们看tid的声明了。这可能很重要。
  • 为什么在有问题的那一行的分号后面有一些**?
  • @Cédric Julien,他(不幸的是)使用星星来确定问题所在。这些不在他的代码中。

标签: c multithreading


【解决方案1】:

Erm....我主要是缺少 pthread_t 的包含

#inlcude <pthread.h>

否则,我很确定它与 tid 的(未显示)定义有关

【讨论】:

    猜你喜欢
    • 2019-01-22
    • 1970-01-01
    • 2015-12-01
    • 2013-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    相关资源
    最近更新 更多