Error: Dereferencing pointer to incomplete type
Codeblocks gives me this error in main.c line 10 (print_bst(tree->root)) (dereferencing pointer to incomplete type) while i'm creating a Binary Search Tree and I can't find the cause to this error.
BST.h
typedef struct Node Node;
typedef struct Tree Tree;
Tree *create_bst();
Node *create_node(int data);
void insert_bst(Tree *tree);
void print_bst(Node *root);
BST.c
#include <stdio.h>
#include <stdlib.h>
typedef struct Node{
void *dataPtr;
int data;
struct Node *left;
struct Node *right;
} Node;
typedef struct Tree{
int count;
Node* root;
} Tree;
Tree *create_bst()
{
Tree *tree = (Tree*) calloc(1,sizeof(Tree));
if(tree == NULL){
printf("calloc() failed!\n");
return NULL;
}
tree->count = 0;
tree->root = NULL;
return tree;
}
Node *create_node(int data)
{
Node *node = (Node*) calloc(1, sizeof(Node));
if(node == NULL){
printf("calloc() failed!\n");
return NULL;
}
node->data = data;
node->right = NULL;
node->left = NULL;
return node;
}
main.c
#include <stdio.h>
#include <stdlib.h>
#include "BST.h"
int main()
{
Tree *tree = create_bst();
while(1){
insert_bst(tree);
print_bst(tree->root);
}
return 0;
}
The error message refers to line 10 in main.c, (print_bst(tree->root)).