我是使用基准测试和 makefile 的新手。我已经从下面的链接下载了 Dhrystone 基准测试,我正在尝试编译它,但我遇到了奇怪的错误。我尝试解决它,但没有成功。有人可以帮助我运行 dhrystone 基准测试吗?\n下面是我尝试编译的两种不同方法。但两者都给出相同的错误结果:(
\n\n链接: http: //fossies.org/unix/privat/old/dhrystone-2.1.tar.gz/
\n\n尝试编译命令:
\n\ngcc -g dhry.h dhry_1.c dhry_2.c -o dhrystonex\n\nmake all \nRun Code Online (Sandbox Code Playgroud)\n\n错误:
\n\ngcc -O -DTIMES -DHZ=60 dhry_1.c dhry_2.c -o gcc_dry2\ndhry_1.c:31:18: warning: conflicting types for built-in function \xe2\x80\x98malloc\xe2\x80\x99 [enabled by default]\ndhry_1.c:48:17: error: conflicting types for \xe2\x80\x98times\xe2\x80\x99\n/usr/include/i386-linux-gnu/sys/times.h:49:16: note: previous declaration of \xe2\x80\x98times\xe2\x80\x99 was here\ndhry_1.c: In function \xe2\x80\x98main\xe2\x80\x99:\ndhry_1.c:98:3: warning: incompatible implicit declaration of built-in function \xe2\x80\x98strcpy\xe2\x80\x99 [enabled by default]\ndhry_1.c:124:11: warning: ignoring return value of \xe2\x80\x98scanf\xe2\x80\x99, declared with attribute …Run Code Online (Sandbox Code Playgroud) 我的任务之一,我有一个任务是以字符串格式打印下面的整个结构.
Struct test
{
int a,
char char1,char2;
}
Run Code Online (Sandbox Code Playgroud)
输出应该是:结构是a = 10,char1 = b,char2 = c; 我知道使用它非常简单
printf("Structure is a=%d,char1=%c, char2= %c", s.a,s.char1,s.char2);
Run Code Online (Sandbox Code Playgroud)
但实时,我有很多大结构,我不能为每个结构元素编写带访问说明符的printf语句.有没有其他方法来打印整个结构只需指定结构变量或其他?