Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. _DEBUG definition

_DEBUG definition

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelpdebuggingannouncement
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    caykahve
    wrote on last edited by
    #1

    Hi, I want to disable some functions in the release build. This is the fucntion:

    void func1(...)
    {
    #ifdef _DEBUG
    func2();
    #endif //_DEBUG
    }

    I still see the outputs of func2() in the release build. My preprocessor definitions for the release build: WIN32;_CONSOLE;NDEBUG debug build: WIN32;_CONSOLE;_DEBUG I don't understand what is wrong. How can i solve the problem? Any help appreciated. Thanks in advance

    T D B 3 Replies Last reply
    0
    • C caykahve

      Hi, I want to disable some functions in the release build. This is the fucntion:

      void func1(...)
      {
      #ifdef _DEBUG
      func2();
      #endif //_DEBUG
      }

      I still see the outputs of func2() in the release build. My preprocessor definitions for the release build: WIN32;_CONSOLE;NDEBUG debug build: WIN32;_CONSOLE;_DEBUG I don't understand what is wrong. How can i solve the problem? Any help appreciated. Thanks in advance

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      caykahve wrote: I still see the outputs of func2() in the release build. i don't understand well. does func2() execute ? what happens when you explicitely write a #undef _DEBUG (at the begining of stdafx.h for example) ?


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      C 1 Reply Last reply
      0
      • T toxcct

        caykahve wrote: I still see the outputs of func2() in the release build. i don't understand well. does func2() execute ? what happens when you explicitely write a #undef _DEBUG (at the begining of stdafx.h for example) ?


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        C Offline
        C Offline
        caykahve
        wrote on last edited by
        #3

        Yes func2() executes. I wrote #undef _DEBUG in stdafx.h and it still executes.

        T 1 Reply Last reply
        0
        • C caykahve

          Yes func2() executes. I wrote #undef _DEBUG in stdafx.h and it still executes.

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          did you try rebuilding the whole project ?


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          C 1 Reply Last reply
          0
          • T toxcct

            did you try rebuilding the whole project ?


            TOXCCT >>> GEII power
            [toxcct][VisualCalc]

            C Offline
            C Offline
            caykahve
            wrote on last edited by
            #5

            I always choose "Rebuild Solution" from build menu. i am using Visual Studio .net 2003 BTW.

            T 1 Reply Last reply
            0
            • C caykahve

              I always choose "Rebuild Solution" from build menu. i am using Visual Studio .net 2003 BTW.

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              what about using DEBUG instead ?


              TOXCCT >>> GEII power
              [toxcct][VisualCalc]

              C 1 Reply Last reply
              0
              • T toxcct

                what about using DEBUG instead ?


                TOXCCT >>> GEII power
                [toxcct][VisualCalc]

                C Offline
                C Offline
                caykahve
                wrote on last edited by
                #7

                doesn't work

                1 Reply Last reply
                0
                • C caykahve

                  Hi, I want to disable some functions in the release build. This is the fucntion:

                  void func1(...)
                  {
                  #ifdef _DEBUG
                  func2();
                  #endif //_DEBUG
                  }

                  I still see the outputs of func2() in the release build. My preprocessor definitions for the release build: WIN32;_CONSOLE;NDEBUG debug build: WIN32;_CONSOLE;_DEBUG I don't understand what is wrong. How can i solve the problem? Any help appreciated. Thanks in advance

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  Use the /P compiler switch on this file. It will preprocess the file into a file with a .i extension. Open that file and look for func1(). That will let you know if _DEBUG is being seen by the preprocessor or not.


                  "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                  1 Reply Last reply
                  0
                  • C caykahve

                    Hi, I want to disable some functions in the release build. This is the fucntion:

                    void func1(...)
                    {
                    #ifdef _DEBUG
                    func2();
                    #endif //_DEBUG
                    }

                    I still see the outputs of func2() in the release build. My preprocessor definitions for the release build: WIN32;_CONSOLE;NDEBUG debug build: WIN32;_CONSOLE;_DEBUG I don't understand what is wrong. How can i solve the problem? Any help appreciated. Thanks in advance

                    B Offline
                    B Offline
                    Bob Stanneveld
                    wrote on last edited by
                    #9

                    It's hard to believe that your function gets executed. Maybe you call func2 somewhere else? Try using the debugger and set a breakpoint in func2. Then see the callstack for the caller. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups