CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Error & Warning

  1. #1
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    425

    Error & Warning

    Code:
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    There is 1 error & 1 warning being displayed pointing to the line in bold above.The code is auto generated.
    warning C4042: 'THIS_FILE' : has bad storage class
    error C2143: syntax error : missing ')' before ';'
    Kindly Help.

    Regards,
    Ankush Mehta

    "The Child is the father of the Man."
    William Wordsworth

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Error & Warning

    My guess is that there is something wrong prior to this code. Maybe you included a erroneous header file?

    This piece of code will generate the same warning/error:
    Code:
    void test(  // the error is actually here
    
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;  // but the compiler reports this line
    #endif
    - petter

  3. #3
    Join Date
    Aug 2000
    Location
    New Jersey
    Posts
    968

    Re: Error & Warning

    Make sure you have your #include headers before this code.

    Don't put #include's after this code.
    David Maisonave
    Author of Policy Based Synchronized Smart Pointer
    http://axter.com/smartptr


    Top ten member of C++ Expert Exchange.
    C++ Topic Area

  4. #4
    Join Date
    Jun 2005
    Location
    Tirunelveli-Tamil Nadu-India
    Posts
    354

    Smile Re: Error & Warning

    use this code after ur include header files.
    Code:
    #ifdef _DEBUG
    #undef THIS_FILE
    static char BASED_CODE THIS_FILE[] = __FILE__;
    #endif
    If I Helped You, "Rate This Post"

    Thanks
    Guna

  5. #5
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    425

    Re: Error & Warning

    Thanks all, the error was in a header file.

    Regards,
    Ankush Mehta

    "The Child is the father of the Man."
    William Wordsworth

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured