C : expected ')' before '*' token 中的编译器错误

标签 c compiler-errors

正如标题所说,尝试编译时不断出现此错误。从谷歌搜索这个错误,人们说它没有在头文件中声明,但我的函数是静态的,它不在头文件中,我对它进行了原型(prototype)设计。`

#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;
}

`

最佳答案

cardinfo struct is still undefined on the line with error.在它前面放一个前置声明:

struct cardinfo;
static int cardinit(struct cardinfo *card);

关于C : expected ')' before '*' token 中的编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3425547/

相关文章:

compiler-errors - 使用 Eclipse Android 编译 FFMPEG

android - 无法在Android Studio中打开Ionic Framework编译的项目

compiler-errors - PureScript无法匹配相同的约束类型

c - 以成员为数组对结构数组进行排序

c - 如何获取结构体中的 char 变量以获取 char 指针的值

java - 比较原始类型

unit-testing - 在 IntelliJ 中运行单元测试,但类中有错误

变量赋值比较

可以将空字符传递给字符串中间的 argv 吗?

c - 指针是先赋值还是递增?