我經歷了其他文章,但沒有像我的問題。 我試圖從一個文件(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