Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor ptclin_2007's Avatar
    Join Date
    Feb 2008
    Posts
    208
    i can use __FUNCTION__ and __FILE__to debug in vc,

    does carbide can use these?

    if can how to do?

  2. #2
    Nokia Developer Champion qxiaoyuan's Avatar
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346
    yes, the macro is defined in vc or carbide, gcce compiler, etc.

    use as normal macro. like

    Code:
    class CFuncTrace
    {
    public:
        CFuncTrace(const char* file, const char* func, int line)
        {
            iFile = (const TUint8*)file;
            iFunc = (const TUint8*)func;
            iLine = line;
            LOG_FMT( KFuncTraceEnterFormat, &iFile, &iFunc, iLine );
        }
        
        ~CFuncTrace()
        {
            LOG_FMT( KFuncTraceLeaveFormat, &iFile, &iFunc, iLine );
        }
    
    private:
        CFuncTrace(const CFuncTrace&);
        CFuncTrace& operator= (const CFuncTrace&);
        
    private:
        TBuf8<100>      iFile;
        TBuf8<100>      iFunc;
        int             iLine;
    };
    
    
    #define FUNC_TRACE(name)            CFuncTrace name(__FILE__, __FUNCTION__, __LINE__)
    #define FUNC_U_TRACE()              CFuncTrace _func_trace_(__FILE__, __FUNCTION__, __LINE__)
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  3. #3
    Regular Contributor ptclin_2007's Avatar
    Join Date
    Feb 2008
    Posts
    208
    thanks!

    i wrote const char* tc = __FILE__ ;
    and compiled error,prompt crosses initialization of `const char*tc'

    what should do?

  4. #4
    Nokia Developer Moderator skumar_rao's Avatar
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

  5. #5
    Nokia Developer Champion savaj's Avatar
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034
    Quote Originally Posted by ptclin_2007 View Post
    i wrote const char* tc = __FILE__ ;
    and compiled error,prompt crosses initialization of `const char*tc'
    Statement const char* tc = __FILE__; looks fine to me. I am wondering why its gives you a initialization error.

  6. #6
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,683
    What is the exact error message you get? Where have you written that line?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved