Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to compile a project differently, according to a constant defined by #define, like this:

#define USE_COMPONENT_X

#if USE_COMPONENT_X
...

#endif

and I can do that in C#. But when I go to another file in the same project, this constant is not defined. Can I in some way define a constant to all the project, like DEBUG is defined so?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
863 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can add the /define compiler switch.

  1. Open the project's Property Pages dialog box.
  2. Click the Configuration Properties folder.
  3. Click the Build property page.
  4. Modify the Conditional Compilation Constants property.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...