| | |
C++ program wont compile
![]() |
•
•
Join Date: Feb 2009
Posts: 1
Reputation:
Solved Threads: 0
I am not too sure about c++. I have this program so i can perform a test on it against java. It looks like
It says at the moment that
1>c:\users\nick\desktop\dd\dd\dd.cpp(4) : fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
How would i go about resolving this issue?
thanks
C++ Syntax (Toggle Plain Text)
#include "stdafx.h" #include <iostream> #include <math.h> #include <sys/time.h> using namespace std; double generate(int max) { struct timeval start; struct timezone tz; gettimeofday(&start, &tz); bool *sieve = new bool[max]; for (int i=0; i<max; i++) sieve[i] = true; sieve[0] = false; sieve[1] = false; for (int n=2; n<sqrt(max); n++) { if (sieve[n]) { for (int j=2*n; j<max; j+=n) sieve[j] = false; } } struct timeval end; gettimeofday(&end, &tz); double startSecond = start.tv_usec/1000000.0; double endSecond = (end.tv_sec - start.tv_sec) + end.tv_usec/1000000.0; return endSecond - startSecond; } int main(int argc, char * argv[]) { for (int i=100000; i<=5000000; i+=100000) { double time = generate(i); cout << i << " " << time << "\n"; } }
It says at the moment that
1>c:\users\nick\desktop\dd\dd\dd.cpp(4) : fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
How would i go about resolving this issue?
thanks
try:
#include <cmath>
#include <ctime>
#include <cmath>
#include <ctime>
Don't own a gun but I'm going to join the NRA.
I figure anything that irritates liberals is worth my support.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
I figure anything that irritates liberals is worth my support.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Oops, never mind. It would appear that you're using a compiler that doesn't support that functionality. VC++ doesn't seem to have it.
Don't own a gun but I'm going to join the NRA.
I figure anything that irritates liberals is worth my support.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
I figure anything that irritates liberals is worth my support.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
If you are trying to compile this Unix BSD-colored snippet on MS VC++ then have a look at
http://trac.osgeo.org/mapserver/ticket/602
May be it helps...
http://trac.osgeo.org/mapserver/ticket/602
May be it helps...
![]() |
Similar Threads
- Can anyone help me - java with mysql (Java)
- undefined reference (C++)
- Help with Memoization pls.. (Java)
- Pascal calculator program (Pascal and Delphi)
- Can't get program to compile (C++)
- My Program Wont Work!! Help!!!!! (C++)
- C++ Compile Error's (C++)
- connect four program wont display anything (C++)
- !NEW!:::::!!Time Display Program!! (C++)
Other Threads in the C++ Forum
- Previous Thread: Program
- Next Thread: First Program
Views: 413 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
algorithm api array arrays assignment beginner binary browser c++ c++borland c/c++ calculator char class classes code compile compiler constructor conversion convert count delete dll dynamic encryption error file files filestream forms fstream function functions game givemetehcodez graph graphics gui homework i/o iamthwee ifstream input int integer lazy library linker list loop loops math matrix memory network newbie news number object objects opengl output parameter pointer pointers problem program programming project random read reading recursion recursive reference return sort sorting spoonfeeding string strings struct student studio template templates text time tree url variable vc++ vector video visual win32 window windows winsock






