including old header file in new source file causes errors?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ECamino on Tue Jun 18 14:08:12 MST 2013

Suppose I have file a.c and file b.c. Both files include "file.h" Everything builds fine. There is a prototype in file.h I want to use in a new file, c.c. So I add #include "file.h" in c.c When I build, all the sudden the compiler doesn't like file.h anymore, which is an example file supplied by NXP/Code Red!

The errors mainly look like this:

error: expected '=', ',', ';', 'asm' or '__attribute__' before (prototype for func xyz)

Also, sturctures are flagged with an error.

Why does this happen? I'm probably overlooking something simple, but then the other two files using the same header build fine?

Sorry, not an expert at this!