2012-03-30 49 views
3

ベンチマークとメイクファイルの新機能です。下のリンクからDhrystoneのベンチマークをダウンロードしてコンパイルしようとしていますが、私は奇妙なエラーに直面しています。私はそれを解決しようとしましたが、私は失敗です。誰かがdhrystoneベンチマークを実行する際に助けてくれますか? 以下は、私がコンパイルしようとした2つの異なる方法です。しかし、どちらも同じエラー結果を与えている:(Unixでdhrystoneをコンパイル中にエラーが発生する

リンク:http://fossies.org/unix/privat/old/dhrystone-2.1.tar.gz/

コマンドをコンパイルするには、を試してみました:

gcc -g dhry.h dhry_1.c dhry_2.c -o dhrystonex 

make all 

エラー:

gcc -O -DTIMES   -DHZ=60    dhry_1.c dhry_2.c -o gcc_dry2 
dhry_1.c:31:18: warning: conflicting types for built-in function ‘malloc’ [enabled by default] 
dhry_1.c:48:17: error: conflicting types for ‘times’ 
/usr/include/i386-linux-gnu/sys/times.h:49:16: note: previous declaration of ‘times’ was here 
dhry_1.c: In function ‘main’: 
dhry_1.c:98:3: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default] 
dhry_1.c:124:11: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] 
make: *** [gcc_dry2] Error 1 

答えて

4

は、次のように変更しますライン。 -で削除する必要があることを示します。の行追加する必要があることを示す前にを入力してください。合計では、あなたは(//でそれらを先行することによって)2行を交換し、1つの改行(#include)を追加します:

diff -bup orig/dhry_1.c new/dhry_1.c 
    --- orig/dhry_1.c  2012-03-30 11:30:41.984107303 -0700 
    +++ new/dhry_1.c  2012-03-30 11:31:29.256002567 -0700 
    @@ -28,7 +28,7 @@ char   Ch_1_Glob, 
    int    Arr_1_Glob [50]; 
    int    Arr_2_Glob [50] [50]; 

    -extern char  *malloc(); 
    +// extern char  *malloc(); 
    Enumeration  Func_1(); 
     /* forward declaration necessary since Enumeration may not simply be int */ 

    @@ -45,7 +45,7 @@ Enumeration  Func_1(); 

    #ifdef TIMES 
    struct tms  time_info; 
    -extern int  times(); 
    +// extern int  times(); 
            /* see library function "times" */ 
    #define Too_Small_Time (2*HZ) 
            /* Measurements should last at least about 2 seconds */ 
    diff -bup orig/dhry.h new/dhry.h 
    --- orig/dhry.h 2012-03-30 11:30:41.984107303 -0700 
    +++ new/dhry.h 2012-03-30 11:31:29.256002567 -0700 
    @@ -392,6 +392,7 @@ 
    /* General definitions: */ 

    #include <stdio.h> 
    +#include <string.h> 
            /* for strcpy, strcmp */ 

    #define Null 0 
+0

ああ!それはいかに簡単です!あなたは数秒で私の仕事をしました。私はまだ理解していなかったなぜ私はそのような単純なコンパイルエラーを見逃した..どのように多くのありがとう。 – bobby

+0

@sreeharivallu:時間を2分かけて問題を解決した回答(http://i.imgur.com/uqJeW.png)を受け取り、あなたの状況に役立つ他の回答をアップアップしてください(http:// i.imgur.com/kygEP.png)。皆さんお元気で。 – shellter

関連する問題