您的位置:首页 > Web前端 > Node.js

关于GCC编译C语言多文件出现类似dereferencing pointer to incomplete type ‘struct TreeNode’的问题

2017-02-02 00:00 260 查看
系统Ubuntu 16.04   编译器Gcc   语言C



工程里面有tree.c, tree.h, fatal.h, main.c,本错误的意思大概是重定向treenode结构体的不兼容的指针。经查资料可知,错误原因是

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

汉语意思是在编译main.c文件的过程中,只有typedef类型是可视化的,而不是结构体的定义。

所以如果想要在main.c中识别到结构体,需要把结构体的相关实现添加在头文件中。

来源:http://stackoverflow.com/questions/4518018/compiler-error-dereferencing-pointer-to-incomplete-type-in-c-programming
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  多c文件编译
相关文章推荐