Show clocks when visual studio code runs C + + code_ PER_ Problems and solutions not defined by SEC


Today, when I wrote the code, I suddenly wanted to know the running time of the program, so I included the time header file in the code. The include file is not marked red, but it appears in theCLOCKS_PER_SECBut the place marked in red shows undefined identifierCLOCKS_PER_SEC


I thought, this is not right. Isn’t it defined in the time file? How can it be undefined, but I see the prompt above. It turns out thatCLOCKS_PER_SECIs an integer quantity, the value is 1000, then I might as well define myself. So I define the macro at the top of the code, there is no red mark, and the running result of the program is the same as that in Visual Studio 2019, so there should be no problem.


In addition, originally my code was the same at the beginning#include<time.h>If I go back to visual studio code after solving the same problem in Visual Studio 2019, it will not be marked in red, just display the identifierCLOCKS_PER_SECUndefined, do not know why, first record it.


This article is about how to display clocks when visual studio code runs C + + code_ PER_ This is the article about the problems not defined by SEC. More about visual studio code running C + + to display clocks_ PER_ SEC undefined content, please search the previous articles of developer or continue to browse the related articles below. I hope you can support developer more in the future!