【发布时间】:2020-06-14 13:03:05
【问题描述】:
我正在尝试使用时钟来测量在 Visual Studio 2015 (x64) 中使用 C++ 在 Windows 上以 Debug x64 模式运行的程序的时间。
我在这些行中遇到错误:
#include <time.h>
#include <sys/timeb.h>
错误消息说:
无法打开源文件“time.h”
无法打开源文件“sys/timeb.h”
我必须添加什么路径才能包含目录才能修复此错误?
【问题讨论】:
-
试试
#include <ctime> -
另外,考虑
库 -
我尝试了
#include <ctime>,但出现了相同的消息:cannot open source file "ctime.h"。该程序曾经在不同的机器上运行,所以我认为它可以通过添加正确的路径来包含。 -
不,和 Windows 10 x64 一样
-
我找到了:docs.microsoft.com/en-us/cpp/c-runtime-library/reference/… 你应该接受这个答案,因为它解决了你的问题。
标签: c++ visual-studio include time.h