#define constant in one *.h file not seen in other *.h files

I am using Clion to edit C code that I compile with another IDE (CodeVisionAVR).

Unfortunately  the preprocessor constants (eg #DEFINE DUMMY_CONST)  that I declare in one *.h file are not visible in other project *.h files.

When I created my C lion project I added all C and H files as existing sources.

The Intellisense works perfectly And each  preprocessor constant from *.h file is visible in *.c files after included. This isn;t the case in my CodeVisionAVR IDE which Compiles the source code correctly so maybe I should  set up something in Clion?

 

regards

Tom

0
3 comments

Hi Tom!

Unfortunately  the preprocessor constants (eg #DEFINE DUMMY_CONST)  that I declare in one *.h file are not visible in other project *.h files.

How are these headers related? Is the header with #define DUMMY_CONST included in any other headers? Or are both the header with #define and some other header include in the same source file?

 

0

Hi Anna,

#define DUMMY_CONST is defined at the top of main.c , below other includes follow:

 

#define CODEVISION

#include <mega2560.h>
#include "avrdefs.h"
#include "pendrive.h"
and so on...

 

Then,when I open avrdefs.h the code below  #ifdef CODEVISION remains grayed out (inactive)

 

I checked this under Visual Studio 2009 and there itworks properly the section is not grayed out that means my define in main.c is visible in avrdefs.h

 

best regards

Tom

 

0

That header file could be included in many different implementation files, some of which define that constant and some of which do not.  How is the editor supposed to know which of these you want to show?

0

Please sign in to leave a comment.