问题描述
我是使用基准和makefile的新用户。我已经从下面的链接下载Dhrystone基准,我试图编译它,但我面临奇怪的错误。我试图解决它,但我不成功。有人可以帮我运行dhrystone基准测试吗?
下面是我尝试编译的两种不同的方法。但两者都给出相同的错误结果:(
I am new in using benchmarks and makefiles. I have downloaded Dhrystone benchmark from the below link and I am trying to compile it, but I am facing weird errors. I tried to solve it,but I am unsuccessful. Can someone help me in running the dhrystone benchmark?Below are the 2 different ways that I tried to compile. But both are giving the same error result :(
链接:
尝试的编译命令:
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
推荐答案
以下更改。在其前面带有 -
的行表示您应该删除。在其前面带有 +
的行表示您应该添加的行。总而言之,您将替换两行(前面加上 //
)并添加一行( #include
):
Make the following changes. A line with a -
before it indicates one you should remove. A line with a +
before it indicates one you should add. In total, you will replace two lines (by preceding them with //
) and add one new line (a #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
这篇关于在unix中编译dhrystone时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!