including old header file in new source file causes errors?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

including old header file in new source file causes errors?

310 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ECamino on Tue Jun 18 14:08:12 MST 2013
Hi,

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!

EC
0 Kudos
Reply
2 Replies

298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ECamino on Wed Jun 19 06:20:13 MST 2013
The file is my slightly modified version of "mw_usbd.h" I call "usb_dev.h."

I added to c.c #[COLOR=black]include mw_usbd_rom_api.h, and that fixed the error.  I don't really understand the problem with the build before I added the include.   c.c at that time had only one function having a delay call and a call of a function which is a void f(void) type.[/COLOR]

EC
0 Kudos
Reply

298 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Jun 19 00:50:47 MST 2013
Have you looked what other include files the original example made use of? I suspect that there may be a dependency.

Other than that, what example and include file are you actually looking at? Giving us real information is much more likely to allow someone to provide you with a solution !!!

Regards,
CodeRedSupport
0 Kudos
Reply