Visual Studio 2008, detecting mem leaks, the symbol '__FILE__' is not defined

Discussion in 'Visual C++ .Net' started by DN Admin, Apr 13, 2012.

  1. DN Admin

    Staff Member

    Joined:
    Aug 7, 2010
    Location:
    Joliet, IL U.S.A.
    Hi
    I am trying to identify memleaks in my c++ program. I use Visual Studio 2008.
    I have found a few tutorials dealing with identifying memleaks while using new, not malloc, for memory allocation and this is what i have defined on top of my main:

    #define __STDC_CONSTANT_MACROS <br/>
    <br/>
    #ifdef _DEBUG<br/>
    #define _CRTDBG_MAP_ALLOC<br/>
    #include <stdlib.h><br/>
    #include <crtdbg.h><br/>
    #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)<br/>
    #define new DEBUG_NEW<br/>
    #endif

    unfortunately I get tons of errors, which you can see here: http://pastebin.com/9ax90VTg http://pastebin.com/9ax90VTg
    But I think I have found the problem: there is neighter __FILE__ nor __LINE__ defined. When I click "RMB->go to definition" OR "RMB->go to declaration" on __FILE__ or __LINE__ i get: "the symbol '__FILE__' is not defined"
    and the symbol '__LINE__ ' is not defined respectively.

    How should I solve this?



    View the full article
     
    #1

Share This Page