variables corrupted

  • Thread starter Thread starter Dave Cullen
  • Start date Start date
D

Dave Cullen

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, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal 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
 
Dave said:
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, ::GetCommandLine(),
0)) {
// TODO: change error code to suit your needs
_tprintf(_T("Fatal 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

The Intellisense database sometimes gets corrupted. Shit happens!

Close the environment, delete the .NCB file in the project directory,
and restart the IDE again. Intellisense will start from scratch, and
build a new .NCB file. Usually works much better than the old one.


Bo Persson
 
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
 
Dave said:
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, ::GetCommandLine(),
0)) {
// TODO: change error code to suit your needs
_tprintf(_T("Fatal 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 said:

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
 
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
 
David Lowndes said:
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
www.RonaldFrancis.com
 
Back
Top