【发布时间】:2016-09-05 20:34:42
【问题描述】:
我正在寻找我的代码中的错误(在 C 中),但我没有找到任何东西。
我查看了许多博客并尝试了许多建议但没有任何帮助的方法。
我已经编码了:
typedef struct Account_t *Account;
struct Account_t {
Customer customer;
Realtor realtor;
Offer offer;
};
而 Realtor、Customer 和 Offer 已明确定义并包含在 .h 文件中。我收到一条错误消息,提示“取消引用指向不完整类型 'struct Account_t' 的指针”:
Account account = malloc(sizeof(*account));
请帮我找出问题!
【问题讨论】:
-
这应该是有效的(见here)。请发布一个完整的示例。出于某种原因,编译器在您使用
malloc时没有看到结构定义。 -
显示
Customer、Realtor和Offer的定义。 -
...而 Realtor、Customer 和 Offer 定义明确...您可以将它们包含在您的帖子中吗?
标签: c database struct error-handling typedef