我收到错误(错误:解除指向不完整类型的指针 )使用addData-> s = s和addData-> type = type,我不知道为什么......它似乎应该对我有用(但我对C有点生疏)
以下是代码:
int addSym(char *s, var_type type){
struct syment* addData= malloc(sizeof(syment));
addData->s = s;
addData->type = type;
...
我有syment as
typedef struct syment_s {
char *s;
int offset;
var_type type;
struct syment_s *next;
}*syment;
谢谢!
答案 0 :(得分:1)
尝试更改
typedef struct syment_s {
char *s;
int offset;
var_type type;
struct syment_s *next;
}*syment;
到
typedef struct syment_s {
char *s;
int offset;
var_type type;
struct syment_s *next;
} syment;
指针超载,这不是Crufts(指针是狗,Crufts是狗展)。