c++visual-studioincludetime.h

C++ cannot open source file "time.h"


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?


Solution

  • You could try #include <ctime>

    Refer to this: http://www.cplusplus.com/reference/ctime/

    time.h is used is C not C++.