|
From: Hongli L. <h....@ch...> - 2002-05-13 17:56:37
|
On Mon, 2002-05-13 at 18:45, Christian Faulhammer wrote:
> Hello,
>
> In university I am doing a programming course and last week we had an
> excercise using a given function to measure time:
>
> ----------------------------8< schnipp------------------------------
> double MyTime() {
> struct timeval Tp;
> gettimeofday (&Tp, NULL);
> return Tp.tv_sec + (Tp.tv_usec /10000000.);
> }
> ----------------------------schnapp >8------------------------------
>
> At home I wanted to finish the program using Dev-C++ (current beta with
> fixed exe), but the compiler refused work when compiling this function
> with the message
>
> ----------------------------8< schnipp------------------------------
> aggregate `struct timeval Tp' has incomplete type and cannot be
> initialized
> ----------------------------schnapp >8------------------------------
>
> But in university (under Linux) it does work....so is this a problem of
> the compiler (gcc versions differ in university and at home) or a
> platform problem (Linux specific parts)? Sorry, I am no expert, just had
> two weeks of this course and I am only used to basic (under DOS).
>
> Chau
>
I believe you need tin #include <sys/time.h>
|