gpt4 book ai didi

visual-c++ - 如何在Windows中使用sys/time.h?

转载 作者:行者123 更新时间:2023-12-03 01:00:27 26 4
gpt4 key购买 nike

我正在使用MSVS 2006,并尝试在程序中以微秒为单位查找时间。我尝试在标头中调用sys / time.h,但已编译此错误。

fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
Error executing cl.exe.


这是我的代码

#include<sys/time.h>
#include<stdio.h>
int main()
{
struc timeval stop,start;
gettimeofday(&start,NULL);

/*my function here*/

gettimeofday(&stop,NULL);
printf("took %lu usec\n",stop.tv_usec-start.tv_usec);
}

最佳答案

不幸的是,MSVC中没有sys \ time.h头文件。相反,请尝试以下链接之一,以获得在Windows上进行编码的帮助。

stackoverflow 1676036

stackoverflow 2494356

关于visual-c++ - 如何在Windows中使用sys/time.h?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25615571/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com