Find the answer to your Linux question:
Results 1 to 2 of 2
i wrote a program etime which returns elapsed time since last call to function while i try to excecte my prog i got an error. /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start': ../sysdeps/i386/elf/start.S:115: ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    2

    problem in excecution

    i wrote a program etime which returns elapsed time since last call to function while i try to excecte my prog i got an error.


    /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start':
    ../sysdeps/i386/elf/start.S:115: undefined reference to `main'
    collect2: ld returned 1 exit status













    #include <sys/time.h>
    #include <time.h>
    #include <stdlib.h>
    #include <stdio.h>


    float etime(void)
    {
    static struct timeval start_time;
    static struct timeval stop_time;
    float elapsed_time;
    static int i;
    i++;
    if(gettimeofday(&stop_time,NULL)!=0)
    exit(0);
    elapsed_time = (float)stop_time.tv_sec - (float)start_time.tv_sec +
    ((float)stop_time.tv_usec -(float) start_time.tv_usec) / 1.e6;
    start_time = stop_time;
    /* printf("%f\n",elapsed_time);*/
    return(elapsed_time);
    }

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,114
    It needs a main function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...