菜鸟关于struct 在多个文件的问题
SqList.h 头文件
///////////////////////////////////////////////////
#define LIST_INIF_SIZE 100
#define LIST_InCREMENT 10
typedef struct SqList
{
int* elem;
int length;
int size;
};
//typedef struct SqList SList;
void InitList(SqList &);
/////////////////////////////////
SqList.c 文件
///////////////////////////////
#include <stdio.h>
#include "SqList.h"
void InitList(struct SqList &list)
{
list.elem = (int*)malloc(LIST_INIT_SIZE * sizeof(int));
if ( !list.elem )
{
}
}
///////////////////
就到这里编译的时候错误信息:
Line1.c
e:\cproject\chap2_1\line1\sqlist.h(15) : error C2143: syntax error : missing ')' before '&'
e:\cproject\chap2_1\line1\sqlist.h(15) : error C2143: syntax error : missing '{' before '&'
e:\cproject\chap2_1\line1\sqlist.h(15) : error C2059: syntax error : '&'
e:\cproject\chap2_1\line1\sqlist.h(15) : error C2059: syntax error : ')'
e:\cproject\chap2_1\line1\line1.c(4) : error C2143: syntax error : missing ')' before '&'
e:\cproject\chap2_1\line1\line1.c(4) : error C2143: syntax error : missing '{' before '&'
e:\cproject\chap2_1\line1\line1.c(4) : error C2059: syntax error : '&'
e:\cproject\chap2_1\line1\line1.c(4) : error C2059: syntax error : ')'