我经历了其他文章,但没有像我的问题。 我试图从一个文件(1.l)访问结构。下面显示的是我在文件1.l中对我的结构的声明和定义。取消引用指向结构中不完整类型的指针
< 1.L>
struct node
{
char words[50];
struct node *next;
};
struct node *head = NULL;
struct node *head1 = NULL;
从我试图访问该文件是2.l. 2.l如下所示。
%{
#include "y.tab.h"
extern struct node *head1;
%}
%x SECTION
%%
"#pragma omp section" { BEGIN SECTION; yyless(0); }
<SECTION>"#pragma omp section" {
fprintf(yyout,"meta_fork");
while(head1 != NULL)
{
\\error in this line fprintf(yyout,"shared(%s)",head1->words);
\\error in this line head1 = head1->next;
}
}
%%
该错误是取消引用指向不完整类型的指针。
任何人都可以请告诉我这里有什么问题。谢谢。
我也尝试过像下面那样定义我的stuct * head1,但仍然得到相同的错误。 struct node * head1 { char words [50]; struct node * next; }; – Sunny