Tell compilation mode from code?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Tell compilation mode from code?

  1. #1
    Join Date
    Dec 2006
    Posts
    109

    Tell compilation mode from code?

    1. Can a C++ program tell in which mode it was built, i.e. debug or release?

    Code:
    #if BUILD_MODE == DEBUG
    #endif
    2. Can I access the compile macros, e.g. $(ConfigurationName), from the code?

  2. #2
    Join Date
    Jul 2002
    Posts
    2,513

    Re: Tell compilation mode from code?

    #ifdef _DEBUG
    // Program is compiled in debug mode
    #endif

    Open Project Properties, C++, Precompiler, Preprocessor definitions. Here you can see all precompiler constants defined in the project. _DEBUG is defined in Debug configuration and not defined in Release configuration. You can add your own constants here and work with them in the code.
    $(ConfigurationName) is macro for build tools, it is not available in the code.

  3. #3
    Join Date
    Dec 2006
    Posts
    109

    Re: Tell compilation mode from code?

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center