Home > Back-end >  Use cranky VSCode debugging C code, C language has a constructor, too?
Use cranky VSCode debugging C code, C language has a constructor, too?

Time:09-16

When VSCode start debugging, there will be a function call before the Main function of the situation, is a very common function, according to my understanding is sure to call the Main function of the following TimerTon1 just a global function, however it is carried out, and in the case of the Main function has no call it also performs, what reason is this? Will ask god to help have a look, and it related VSCode environment configuration, configuration is as follows?


 
Unsigned char TimerTon1 (pt) Ton *
{
Printf (" this is here \ n "); Reference
Quote:

/*
If (pt - & gt; BEnable==1)
{
If (pt - & gt; BR_trig!=gTimeNumber)
{
Pt - & gt; NET++;
}
Pt - & gt; NET++;
}

The else
{
Pt - & gt; NET=0;
Pt - & gt; BR_trig=0;
}


If (pt - & gt; NET & gt;=pt - & gt; Ntimecount)
return 1;
The else
{
return 0;
}

Pt - & gt; BR_trig=gTimeNumber;
*/
return 0;
}
Unsigned char TimerTon2 (pt) Ton *
{
Printf (" this is here2 \ n ");
return 0;
}

Void simluationtime ()
{
If (gTimeNumber==1)
{
GTimeNumber=0;
return;
}


If (gTimeNumber==0)
{
GTimeNumber=1;
return;
}
}




Int main (int arg c, char * const argv [])
{

Printf (" this is the main \ n ");
/*

T1. BEnable=1;
T1. Ntimecount=20000;

while(! TimerTon1 (& amp; T1))
{
Simluationtime ();
}


Printf (" timing to % d \ n ", t1.nET).
*/
Getchar ();
return 0;

}


Lanuch. Json
 {
"Version" : "0.2.0,"
"Configurations:" [

{
"Name" : "c + + Launch),//configuration name, will be in the Launch configuration drop-down menu shown in
"Type" : "CPPDBG",//configuration type, here only for CPPDBG
"Request" : "launch",//request configuration type, to launch (start) or the attach (additional)
"TargetArchitecture" : "x86",//generates target architecture, generally for x86 or x64, for x86 and arm, arm64, MIPS, x64, amd64, x86_64
"The program" : "${workspaceFolder}/${fileBasenameNoExtension}. Exe",//to debug program path

"MiDebuggerPath" : "C:/MinGW/bin/GDB. Exe",//miDebugger path, note here with MinGW path corresponding to the

"Args" : [],//program debugging when passed to the command line arguments, can be sent to
is set to null"StopAtEntry" : false,//set to true when the program will be suspended at the entrance to the program, usually set to false
"CWD" : "${workspaceRoot}",//debug program working directory, usually ${workspaceRoot} the code directory
"ExternalConsole" : true,//debug whether display console window, generally set to true display console
"PreLaunchTask" : "GCC",//debug session prior to the start of the task, generally for the compiler, for g + + c + +, c for GCC
"SetupCommands" : [
{
"Description" : "Enable pretty - printing for GDB",
"Text", "- the enable - pretty - printing",
"IgnoreFailures" : true
}
]
}
]

}


 {
"Version" : "2.0.0,"
"Command" : "GCC",
"Args" : [
"Hunt",
"- g,"
"${file}",
"- o,"
"${fileBasenameNoExtension}. Exe"
],
"EchoCommand" : true,
"ProblemMatcher" : {
"The owner", "CPP",
"FileLocation" : [
"Relative",
"${workspaceFolder}
"],
"The pattern" : {
"Regexp:" ^ "(. *) : (\ \ d +) : (\ \ d +) : \ \ s + (warning | error) : \ \ s + $" (. *),
"File" : 1,
"The line" : 2,
"Column" : 3,
"Severity" : 4,
"Message" : 5
}
},
"Tasks" : [
{
"Type" : "shell",
"Label" : "GCC",
"Command" : "C: \ \ MinGW \ \ bin \ \ GCC exe",
"Args" : [
"- g,"
"${file}",
"- o,"
"${fileDirname} \ \ ${fileBasenameNoExtension}. Exe"
],
"Options" : {
"CWD" : "${workspaceFolder}
"},
"ProblemMatcher" : [
"$GCC
"],
"Group" : {
"Kind" : "build,"
"IsDefault" : true
}
}
]
}















CodePudding user response:

The constructor is the content of the c + +

CodePudding user response:

C language has no constructor, but has a function pointer ~
  • Related