【发布时间】:2011-09-23 05:36:27
【问题描述】:
相同的代码在 TURBO C 中运行。
struct details
{
char name[20];
int year;
float price;
}my_str;
details book1[10];
产生此错误。如何解决这个问题?
ram.c: In function ‘main’:
ram.c:11:1: error: ‘details’ undeclared (first use in this function)
ram.c:11:1: note: each undeclared identifier is reported only once for each function it appears in
【问题讨论】:
-
出现错误的原因是在 C++ 中允许像上面那样编写,但在 C 中不允许。我的猜测是 Borland 在转向 C++ 时添加了它作为 Turbo C 的扩展。
标签: c gcc compilation struct