C中的编译器错误:在'*'标记之前预期')'

kho*_*hop 3 c compiler-errors

正如标题所说,在尝试编译时不断收到此错误.从谷歌搜索这个错误人们说,它没有在头文件中声明,但我的功能是静态的,它不在头文件中,我原型.

#include <recGbl.h>
#include <devSup.h>
#include <devLib.h>
#include <drvIpac.h>
#include <dbScan.h>
#include <epicsExport.h>

static int cardinit(cardinfo *card);   // <-- line that gives the error

typedef struct cardinfo{
  struct cardinfo *next;

  struct io_mem_read *pMem;   /* IP register (A16) mem address */
  word *rambase;             /* RAM conversion memory mem address*/

  int isconfigured;
  int doram;   /* 1 if we are using the RAM to output data.
          0 if we are writing to registers (AO style) */

  int cardnum;
  int vmeslotnum;
  int ipslotnum;


  /* these values mirror the hardware registers */
  word csr;
  word offset;
  word numconv;
  word clockrate;
  word vectnum;


  word dacval[MAXSIGNAL];

  word oldispresent;
  /* used to detect a reinsertion of a carrier card.
     see subroutine ispresent() below. */

  /* use to update process variables */
  IOSCANPVT ioscanpvt;
} cardinfo;

static int Hy8402init(int vmeslot, int ipslot, int clockrate) {
    cardinfo *card;

    card->vmeslotnum = vmeslot;
    card->ipslotnum = ipslot;
    card->cardnum = 1;

    card->clockrate = clockrate;
    card->vectnum = 10;

    cardinit(card);

return TRUE;
}

static int cardinit(cardinfo *card){
  word rprobe;
  int res;
  volatile word *ramptr;

  card->pMem= ipmBaseAddr(card->vmeslotnum,
              card->ipslotnum,ipac_addrIO);  
  if (card->pMem==NULL){
    printf("Error in %s",devstr);
    printf( "%s: Cannot determine base address\n",devstr);
    return FALSE;
  }

  res=devReadProbe(sizeof (word),(char *) card->pMem,(char *) &rprobe);
  if (res!=OK){
    printf("%s: NO DEVICE at %x (vmeslot %d, ipslot %d)\n",devstr,
       (int)card->pMem,
       card->vmeslotnum,card->ipslotnum);
    return FALSE;
  }
return TRUE;
}
Run Code Online (Sandbox Code Playgroud)

`

Vla*_*mir 17

在错误的行上仍未定义cardinfo结构.在它面前提出前瞻性声明:

struct cardinfo;
static int cardinit(struct cardinfo *card);
Run Code Online (Sandbox Code Playgroud)


小智 8

这行代码:

static int cardinit(cardinfo *card);  
Run Code Online (Sandbox Code Playgroud)

应该在定义cardinfo结构后添加.