I'm trying to open a CFile using this code:
I get an internal compiler error number C1001. All optimizations are turned off for the debug version. This is happening in MSVC 6.
CFile::modeCreate || CFile::modeNoTruncate ||
errorText.Format("Could not open file\n %s",cause);
Either way the file is not being opened because it says it cannot find it. However if you notice I use CFile::modeCreate which should create the file regardless if it exists or not.
> CFile::modeCreate || CFile::modeNoTruncate
I think you're using the wrong kind of 'or'
Use the bitwise |, not the logical ||
I can't believe I didn't catch that.
What a noob error.
It's because of the double colons (:: ) everywhere.
See? This is why I don't get into C++. ;)
Well it really threw the compiler off. It couldn't even recover enough to tell me what the error was except for internal compiler error C1001.
It also threw the heap off, the stack off and several other things as well.
I couldn't believe that all this could happen from 1 error like that. Even when it would compile w/o having CFile::modeNoTruncate, the CFile class still acted very weird as well as the CArchive class.
When I would attempt to close the archive, it would assert horribly in release and debug versions, but it was inside of crtdebug.h which was ....um....not good.
Sometimes even in the new MSVC 05 .NET it is still very hard to trace errors because the debugger constantly shows code that is not yours. I'm not sure if there is a way to prevent this since a programmer could cause an assertion in MSVCRT and in Kernel32.DLL due to improper use.