關於GCC編譯C語言多文件出現相似dereferencing pointer to incomplete type ‘struct TreeNode’的問題

    系統Ubuntu 16.04    編譯器Gcc   語言Cnode

    

工程裏面有tree.c, tree.h, fatal.h, main.c,本錯誤的意思大概是重定向treenode結構體的不兼容的指針。經查資料可知,錯誤緣由是spa

Because in compiling main.c, only the typdef is visible, not the definition of struct Treenode (which is in A.c). 指針

漢語意思是在編譯main.c文件的過程當中,只有typedef類型是可視化的,而不是結構體的定義。ci

因此若是想要在main.c中識別到結構體,須要把結構體的相關實現添加在頭文件中。get

來源:http://stackoverflow.com/questions/4518018/compiler-error-dereferencing-pointer-to-incomplete-type-in-c-programming編譯器

相關文章
相關標籤/搜索