variables corrupted

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Cullen

    variables corrupted

    I have a VS 2005 C++ console application supporting MFC. Something's
    happened since my last edit (it was working) and now I'm seeing corrupted
    variables and Intellisense doesn't even recognize them. For instance in the
    main function, if I Quickwatch nRetCode the IDE says error CX0017 symbol not
    found.

    int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
    {
    int nRetCode = 0;
    // initialize MFC and print and error on failure
    if (!AfxWinInit(:: GetModuleHandle (NULL), NULL, ::GetCommandLin e(), 0))
    {
    // TODO: change error code to suit your needs
    _tprintf(_T("Fa tal Error: MFC initialization failed\n"));
    nRetCode = 1;
    }
    else
    {
    ////////////////////////////////////
    // Begin application here
    }
    }

    This is right at the beginning of the program, before any function calls
    that I make. The only other code in the main module is a few function
    declarations and #includes. I've commented everything else out. Is there any
    way to figure out what's going on without starting a new project and adding
    all the source one cpp at a time until it breaks again?

    Thanks


  • David Lowndes

    #2
    Re: variables corrupted

    >I have a VS 2005 C++ console application supporting MFC. Something's
    >happened since my last edit (it was working) and now I'm seeing corrupted
    >variables and Intellisense doesn't even recognize them. For instance in the
    >main function, if I Quickwatch nRetCode the IDE says error CX0017 symbol not
    >found.
    Are you debugging the release build?

    Dave

    Comment

    • Ben Voigt [C++ MVP]

      #3
      Re: variables corrupted

      Dave Cullen wrote:
      I have a VS 2005 C++ console application supporting MFC. Something's
      happened since my last edit (it was working) and now I'm seeing
      corrupted variables and Intellisense doesn't even recognize them. For
      instance in the main function, if I Quickwatch nRetCode the IDE says
      error CX0017 symbol not found.
      Close Visual Studio, delete .ncb, .bsc, .ilk, *.sbr, *.obj.

      Open Visual Studio again and select "Rebuild All".

      That will probably help your problem.
      >
      int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
      {
      int nRetCode = 0;
      // initialize MFC and print and error on failure
      if (!AfxWinInit(:: GetModuleHandle (NULL), NULL, ::GetCommandLin e(),
      0)) {
      // TODO: change error code to suit your needs
      _tprintf(_T("Fa tal Error: MFC initialization failed\n"));
      nRetCode = 1;
      }
      else
      {
      ////////////////////////////////////
      // Begin application here
      }
      }
      >
      This is right at the beginning of the program, before any function
      calls that I make. The only other code in the main module is a few
      function declarations and #includes. I've commented everything else
      out. Is there any way to figure out what's going on without starting
      a new project and adding all the source one cpp at a time until it
      breaks again?
      Thanks

      Comment

      • Dave Cullen

        #4
        Re: variables corrupted


        "David Lowndes" <DavidL@example .invalidwrote in message Are you
        debugging the release build?
        >
        Dave
        What an idiot I am. Yes, I was. Strange that VS 2005 didn't tell me that.
        VC6 would have said there's no debug info...

        Oops. Thanks.
        Dave


        Comment

        • David Lowndes

          #5
          Re: variables corrupted

          >What an idiot I am. Yes, I was. Strange that VS 2005 didn't tell me that.
          >VC6 would have said there's no debug info...
          With newer versions of VS, release build projects have debug info in
          them, but as it's optimised you will see things like the curious
          effects you had.

          I'm glad it's sorted anyhow :)

          Dave

          Comment

          • Ron Francis

            #6
            Re: variables corrupted

            "David Lowndes" <DavidL@example .invalidwrote in message
            news:urdlr3l1q4 ns1l5i8144ifrod 0rso81hs9@4ax.c om...
            What an idiot I am. Yes, I was. Strange that VS 2005 didn't tell me that.
            >>VC6 would have said there's no debug info...
            >
            With newer versions of VS, release build projects have debug info in
            them, but as it's optimised you will see things like the curious
            effects you had.
            >
            I'm glad it's sorted anyhow :)
            >
            Dave
            Well picked Dave.

            Regards,
            Ron Francis



            Comment

            Working...