Jump to content
  • Advertisement
Sign in to follow this  
cpp forever

Visual Studio 7 question

This topic is 4819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!