Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #17685

Re: Conditional compilation

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: Conditional compilation
Date 2012-02-21 07:42 +1300
Message-ID <9qfig1F22vU1@mid.individual.net> (permalink)
References <d04b882b-429a-4167-adbb-99a17cd3ac9d@i18g2000yqf.googlegroups.com>

Show all headers | View raw


On 02/21/12 06:57 AM, ashu wrote:
> Hi all, I have a very trivial problem with conditional compilation. I
> have a header file called
> wrapper.h which is like the global header file for my project. In this
> header file I want to define a conditional compilation tag called
> DEBUG. This file wrapper.h includes several other files called demo1.h
> demo2.c etc. as follows.
>
> /***** wrapper.h****/
>
> #define DEBUG
> #include demo1.h
> #include demo2.h
> ........
>
> /*****end of wrapper.h**/
>
> Now if I try to use the conditional compilation flag DEBUG in any of
> these included files, like demo1.h or demo2.h I get an error and the
> compilation fails.
>
> /**** demo1.h ***/
> # if defined (DEBUG)
> #define BASE_ADDRESS
> #endif
>
> /***end of demo1.h***/
>
> Can someone help me and point to me my mistake ? The compilation error
> is BASE_ADDRESS undeclared and I am using GCC.
>
> regards
>
> /***end of demo1.h**/

Showing the actual error and the code where it occurs would help.

-- 
Ian Collins

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Conditional compilation ashu <ashutosh.ghildiyal@gmail.com> - 2012-02-20 09:57 -0800
  Re: Conditional compilation Ian Collins <ian-news@hotmail.com> - 2012-02-21 07:42 +1300
  Re: Conditional compilation Shao Miller <sha0.miller@gmail.com> - 2012-02-20 14:52 -0500
  Re: Conditional compilation Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-20 14:52 -0500

csiph-web