I am trying to use clocks to measure the time of the running program in Visual Studio 2015 (x64) with C++ on Windows in Debug x64 mode.
I get errors in these lines:
#include <time.h>
#include <sys/timeb.h>
The errors messages say:
cannot open source file "time.h"
cannot open source file "sys/timeb.h"
What path do I have to add to include directories in order to fix this error?
You could try #include <ctime>
Refer to this: http://www.cplusplus.com/reference/ctime/
time.h is used is C not C++.
read this it explain that your method is POSIX, so your path to the sys/time.h must be set well
but there are 2 others way for: how to get time in milliseconds with cpp
https://www.delftstack.com/howto/cpp/how-to-get-time-in-milliseconds-cpp/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.