在unix中编译dhrystone时出错
Errors while compiling dhrystone in unix
我是使用基准测试和makefile的新手。我已经从下面的链接下载了Dhrystone基准测试,我正在尝试编译它,但我面临着奇怪的错误。我试图解决它,但没有成功。有人能帮我运行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
进行以下更改。前面有一个-
的行表示应该删除一个。前面有一个+
的行表示您应该添加一个。总共,您将替换两行(在它们前面加上//
)并添加一行(#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
相关文章:
- 访问者访问变体并返回不同类型时出错
- 在Linux for Windows上编译C++代码时出错
- 读取文件的最后一行并输入到链接列表时出错
- 重载操作程序时出错>>用于类中的字符串 memebr
- 调用专用模板时出错"no matching function for call to [...]"
- C++-试图将函数指针推回到另一个CPP文件中的矢量时出错
- LINK 尝试使用 OpenSSL evp aes 256 c++ 时出错
- 在Google Kick start中提交时出错
- 在c++中访问int到类对象的映射时出错
- 分段错误当我试图运行程序时出错
- 使用dynamic_cast和构造函数时出错
- CHECK(调用)函数在Google Colab中出错
- 用pybind11包装C++抽象类时出错
- 为x86而非x64编译时出错
- 从R调用C++函数并对其进行集成时出错
- 这个函数哪里出错了
- C++ 创建包含链表和字符串的对象的链接列表时出错
- 为重写std::exception的库生成swig接口时出错
- 导入/导出变量时出错
- 在unix中编译dhrystone时出错