Home > Software engineering >  Compilation of open source code prompt error
Compilation of open source code prompt error

Time:09-26

Recently in compiling crystaldiskinfo, compile time appear assert the debug failed, environmental vs2017 community edition,
 
cause I see code is not particularly smooth, forget you greatly help to solve the
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */
//the Author: hiyohiyo
//Mail: [email protected]
//Web: https://crystalmark.info/
//License: The MIT License
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- */

# include "stdafx. H"
# include & lt; IO. H>


The static const DWORD DEBUG_MODE_NONE=0;
The static const DWORD DEBUG_MODE_LOG=1;
The static const DWORD DEBUG_MODE_MESSAGE=2;

The static DWORD debugMode=DEBUG_MODE_LOG;

Void SetDebugMode (DWORD mode)
{
If (mode & lt;=DEBUG_MODE_MESSAGE)
{
DebugMode=mode;
}
The else
{
DebugMode=DEBUG_MODE_NONE;
}
}

Void DebugPrint (cstrings CSTR)
{
Static int flag=TRUE;
The static TCHAR file [MAX_PATH];
The static DWORD first=GetTickCount ();
Cstrings output;

The output Format (_T (" % d "08), GetTickCount () - first);
The output +=CSTR;
The output. Append (_T (" \ n "));
The output. The Replace (_T (\ "r"), _T (" "));

If (flag)
{
TCHAR * ptrEnd;
: : GetModuleFileName (NULL, file, MAX_PATH);
If ((ptrEnd=_tcsrchr (file, '. '))!=NULL)
{
* ptrEnd='\ 0';
_tcscat_s (file, MAX_PATH, _T (" log "));
}
The DeleteFile (file);
Flag=FALSE;
}

If (debugMode==DEBUG_MODE_NONE)
{
return ;
}

FILE *fp;
_tfopen_s (& amp; Fp, file, _T (" ac "));
_ftprintf (fp, _T (" % s "), (LPCTSTR) output);
The fflush (fp);
fclose(fp);

If (debugMode==DEBUG_MODE_MESSAGE)
{
AfxMessageBox (output);
}
}

CodePudding user response:

Assert in the search for files

CodePudding user response:

At least a single-step tracking code first, see anomalies appear in what position to analysis

CodePudding user response:

Is not assert will quote file and line number? Positioning directly to there, put a breakpoint debugging bai

CodePudding user response:

Collapsed in the pop-up dialog box, press the corresponding button to enter debugging press Alt + 7 key to view the Call Stack, namely "the Call Stack" from the inside to the following out of from the inner to outer function Call history, double-click a row to the cursor to the Call of the source code or assembly instruction, don't understand when double click on the next line, until we can read ,
  • Related