I've split up my program into different .c and .h. files with functions in .c and function prototypes, structs and typedefs in the .h files.
Let's say I have car.c and car.h. These include functions that take in a Sensor* sensor however Sensor is a typedef struct from sensor.h. So I simply write #include "sensor.h" in car.h. Now both car.c and car.h have access to Sensor and my IDE seems to confirm that.
The problem arises from the functions themselves that argue Sensor* sensor. Let's say I have void printCarSensors(Sensor* sensor1, Sensor* sensor2) {}. Both car.c and car.h will be happy with the Sensor* type. car.c will be entirely happy, no errors at all.
However, car.h will have a red line under printCarSensors and the error will be:
declaration is incompatible with "void printCarSensors(Sensor* sensor1,
Sensor* sensor2) " (declared at line 26 of "C:\Users\user\Desktop
WorkingFiles\car.c")
In sensor.h I would have
typedef struct sensor Sensor;
struct sensor{
int time;
int speed;
int acceleration;
int temp;
};
Hopefully that all makes sense and any help would be greatly appreciated.