Page 1 of 1

How do I do defines visible in included header files

Posted: Sat Nov 16, 2013 8:41 pm
by part1zan_
I have a main.c file, in which I define some common things, e. g.:

Code: Select all

#define BMP085_I2CD I2CD1

And in bmp085.h which I incude I do the following:

Code: Select all

#ifndef BMP085_I2CD
#error "bmp085 c**p undefined!!!11"
#endif

Guess what? That little piece of code is never defined.
How do I make this define visible to included bmp085.h?

Re: How do I do defines visible in included header files

Posted: Sat Nov 16, 2013 9:05 pm
by Giovanni
You should define it before including the header file. You may also add a -Dxxxxx=yyyyy to the makefile.

Giovanni