在非结构或联合中请求成员“thisWalkno”。 (线程)

Request for member ‘thisWalkno’ in something not a structure or union. (Pthreads)

我试图将结构中的一些变量放入单独线程中的另一个变量中,但我似乎做不到。我有一个这样的结构

typedef struct arguments {
      char thisStart[10];
      char thisWalkno[10];
      char thisMatsize[10]; 
      char thisShmkey[10];
      int *pint;
}arguments;

然后我有我的主要部分,在一些初始变量声明之后,我开始将我的变量放入我的结构中

main ( int argc, char argv[]) {
    arguments tid_arg;
    pthread_t tid;
       .    
       .
       .
       .  


    sprintf(tid_arg.thisWalkno,  "%d", (m + 1));  
    sprintf(tid_arg.thisStart,   "%d", start);  
    sprintf(tid_arg.thisMatsize, "%d", matsize);  
    sprintf(tid_arg.thisShmkey,  "%d", shmkey);

    pthread_attr_init(&attr);
    /* create the thread */
    if (pthread_create(&tid, &attr, tidchild, (void *)&tid_arg) != 0) {
        printf("Could not execute child program\n");
        exit(1);
    } 
     . 
     .
     .
}

最后是我的 tid 子函数

void *tidchild(void *tid_arg) {

    struct arguments *args = tid_arg;
    int walkno, start, shmid, matsize;

    walkno  = atoi(args.thisWalkno);
    pthread_exit(0);
}

当我到达 walkno = atoi(args.thisWalkno) 时,这就是我的错误所在,我似乎无法从结构访问 thisWalkno。有人可以帮助我吗?

我还忘了说,当我输入 args->thisWalkno 时,出现 "dereferencing pointer to incomplete type" 错误。

args 是指向结构的指针,使用 args->thisWalkno 并且您应该 #include 在需要使用它的任何地方定义 struct