Hello,
gcc 4.4.4 c89
I am keep getting a "Cannot dereference to incomplete type".
However, I am sure I have my structure type complete. I return the Network_t instance that is the pointer to the allocated memory. I should be able to dereference that memory.
Many thanks for any advice,
I have this in my header file: driver.h
typedef struct Network_t Network_t;
Network_t* create_network(int id);
Implementation file driver.c
#include "driver.h"
struct Network_t {
int id;
};
Network_t* create_network(int id)
{
Network_t *network = malloc(sizeof *network);
if(network) {
network->id = id;
}
return network;
}
And in my main.c
#include "driver.h"
Network_t *network = NULL;
network = create_network(1);
printf("Network ID: [ %d ]\n", network->id); /* Cannot dereference pointer to incomplete type */