How do I do defines visible in included header files

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
part1zan_
Posts: 44
Joined: Sun Sep 08, 2013 9:04 pm

How do I do defines visible in included header files

Post 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?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

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

Post by Giovanni »

You should define it before including the header file. You may also add a -Dxxxxx=yyyyy to the makefile.

Giovanni
Post Reply