Thread: Trying to Compile a Dhrystone C Code program

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    3

    Trying to Compile a Dhrystone C Code program

    Hi Everyone:

    Please forgive me since I'm a newbie in Linux Programming. (I've been programming in Windows for a long time)

    I'm trying to compile a drhystone C code program that I obtained from here

    http://www.netlib.org/benchmark/dhry-c

    This is a script and I actually downloaded the script and ran "sh dhry-c" to get all my C-files.

    Then, I type in gcc dhry_1.c -o dhrybench and I get this following error:

    /usr/include/sys/times.h:49: error: previous declaration of `times'
    dhry_1.c: In function `main':
    dhry_1.c:266: error: `HZ' undeclared (first use in this function)
    dhry_1.c:266: error: (Each undeclared identifier is reported only once
    dhry_1.c:266: error: for each function it appears in.)

    I'm not exactly sure why I got this error because the "HZ" function is defined in one of the header files.

    Is there an option I need to put into the gcc command line or is this benchmark broken?

    Please respond as soon as possible. Time is very limited. Thanks a lot

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Code:
    $ gcc -DTIME dhry_1.c dhry_2.c
    dhry_1.c:31: warning: conflicting types for built-in function ‘malloc’
    dhry_1.c: In function ‘main’:
    dhry_1.c:94: warning: incompatible implicit declaration of built-in function ‘strcpy’
    I get an executable, which I then enter a large number into to get it to produce an answer.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    3
    Quote Originally Posted by Salem
    Code:
    $ gcc -DTIME dhry_1.c dhry_2.c
    dhry_1.c:31: warning: conflicting types for built-in function ‘malloc’
    dhry_1.c: In function ‘main’:
    dhry_1.c:94: warning: incompatible implicit declaration of built-in function ‘strcpy’
    I get an executable, which I then enter a large number into to get it to produce an answer.
    Dumb question, what does -DTIME do?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    man gcc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How Can I compile 3 source code in 1 program ?
    By lord_cedrich in forum C Programming
    Replies: 8
    Last Post: 12-10-2006, 05:10 AM
  2. What is wrong with my code? My first program......
    By coreyt1111 in forum C++ Programming
    Replies: 11
    Last Post: 11-14-2006, 02:03 PM
  3. C program compile but not doing the calculations
    By abs.emailverify in forum C Programming
    Replies: 8
    Last Post: 11-08-2006, 08:43 AM
  4. how do I morse code converting program
    By panfilero in forum C Programming
    Replies: 17
    Last Post: 10-29-2005, 09:16 PM