0

I am trying to run a C program in Visual Studio 2013.

In this code I'm using sys/time.h header, and I am receiving following errors:

error : cannot open source file "sys/time.h"
1>    #include<sys/time.h>

What am I missing?

jweyrich
  • 31,198
  • 5
  • 66
  • 97
Ata ul nasar
  • 89
  • 2
  • 9
  • 2
    Welcome to the wonderful world of [Cross Platform Development](https://www.google.com/search?q=cross-platform+compilation&oq=cross-platform+compilation&aqs=chrome..69i57j0l5.3383j0j7&sourceid=chrome&es_sm=93&ie=UTF-8#q=cross-platform+programming+%2B+c%7Cc%2B%2B). – Qix - MONICA WAS MISTREATED Oct 04 '14 at 21:35
  • No because that answer did not help me. – Ata ul nasar Oct 04 '14 at 21:36
  • 3
    @ataulanser You're trying to use POSIX headers on Windows. Use the Windows API or C library. –  Oct 04 '14 at 21:36
  • 2
    @Ataulnasar sys/time.h doesn't exist on windows. You'll have to tell us what you need in sys/time.h, and perhaps people can suggest alternatives. – nos Oct 04 '14 at 21:38
  • I am using this to calculate the time complexity of my program in microseconds. – Ata ul nasar Oct 04 '14 at 21:44
  • Time complexity is described in big-O notation, not in microseconds. It cannot be measured, as it's a theoretical concept. –  Oct 04 '14 at 22:01
  • Sorry about my bad explanation. I want to calculate execution time of a code snippet in microseconds. – Ata ul nasar Oct 04 '14 at 22:06
  • 2
    @Ataulnasar: You probably want `QueryPerformanceCounter`, take a look at [this](http://stackoverflow.com/a/2150334/586873) answer. – Grzegorz Szpetkowski Oct 04 '14 at 22:31
  • Thanks all of them for helping me to solve my issue. – Ata ul nasar Oct 04 '14 at 23:07
  • You can find answer in follow link [enter link description here](https://stackoverflow.com/questions/25615571/how-to-use-sys-time-h-in-window) – YuhaoQI Jun 04 '18 at 09:08

0 Answers0