【发布时间】:2016-04-11 17:59:03
【问题描述】:
我刚从 C 开始。我正在尝试编译并执行以下代码,但出现错误。
同时运行 size 在 BS 或数据堆栈中没有显示任何内容?
#include<stdio.h>
/* test.c: My first C program on a Linux */
int main(void)
{
printf("Hello! This is a test prgoram.\n");
return 0;
}
编译作品:
gcc -c test.c -o test
执行:
bash: ./test: cannot execute binary file: Exec format error
尺寸:
text data bss dec hex filename
108 0 0 108 6c test
【问题讨论】:
-
移除
-c选项。 -
你可能打算使用
-std=c11或类似的,告诉编译器编译为标准c。
标签: c