Visual Studio 7 question

Started by
3 comments, last by cpp forever 18 years, 7 months ago
Having <inc.h>, <inc.cpp>, "main.cpp". In "main.cpp" there is defined APP_DEBUG and included <inc.h>. <inc.cpp> and "main.cpp" are compiled into independent OBJs. But how to force the <inc.cpp> source file to know that APP_DEBUG is defined?
ai-blog.org: AI is discussed here.
Advertisement
In main.cpp, after including inc.h, do this:
#undef APP_DEBUG
Quote:Original post by Mercury
In main.cpp, after including inc.h, do this:
#undef APP_DEBUG


Doesn't help. <inc.cpp> doesn't know that APP_DEBUG is defined.
ai-blog.org: AI is discussed here.
Quote:Original post by cpp forever
Quote:Original post by Mercury
In main.cpp, after including inc.h, do this:
#undef APP_DEBUG


Doesn't help. "inc.cpp" doesn't know that APP_DEBUG is defined.

You'd define it in the header file, include it in its source file, then include it in main and undefine it in main. Or you could define something in main telling the header to act differently because it's main. What is this for, anyway?
Quote:Original post by Mercury
Quote:Original post by cpp forever
Quote:Original post by Mercury
In main.cpp, after including inc.h, do this:
#undef APP_DEBUG


Doesn't help. "inc.cpp" doesn't know that APP_DEBUG is defined.

You'd define it in the header file, include it in its source file, then include it in main and undefine it in main. Or you could define something in main telling the header to act differently because it's main. What is this for, anyway?


I wanted not to touch headers, cos there can be several of them. Well, I can do the header (where APP_DEBUG is defined) for these headers. It is the only solvement, I think.

I don't want main to act different. I want all CPPs act the same, but place only one string
#define APP_DEBUG
in only one file. Will be doing this in some header. Thanks.
ai-blog.org: AI is discussed here.

This topic is closed to new replies.

Advertisement