Skip to main content
gamedev.net
🔒 Locked

gettimeofday() undefined!

Started by j0mich01 3 replies 4.6k views
Original Post
j0mich01
j0mich01
I'm trying to use the function gettimeofday(), but I get an error saying it's not defined. It should be in , but It's not in there. I think I probably have an old time.h, but when I replaced it, I just got more errors. Anybody have a solution to this problem?
dave
dave
I don't know the answer but man -k usually answers your question.
Crypter
Crypter
Quote:

I'm trying to use the function gettimeofday(), but I get an error saying it's not defined. It should be in , but It's not in there. I think I probably have an old time.h, but when I replaced it, I just got more errors. Anybody have a solution to this problem?

What compilier do you have?

Header files only contain declarations, not actual code definitions.
Replacing just a *.h file may cause problems when linking with
the libraries.. (ak, undefined symbols useally)
j0mich01
j0mich01
I'm using Dev C++ with the GCC Compiler
let_bound
let_bound
Apparently the C runtime of MinGW consists of whatever is in msvcrt.dll, and AFAIK Microsoft doesn't provide an implementation of gettimeofday(2), which makes sense as it's a SVr4/4.3BSD/POSIX API. Your only options on Windows are probably to use Cygwin (if you aren't bothered by the GPL license and the runtime impact) or to implement your own version of the function.

Hope this helps.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.