小编Wal*_*lyZ的帖子

gcc 不会编译为可执行文件

#include <stdlib.h>

int main(int argc, char* argv[]) 
{
    // printf("Hello World!\n");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

海湾合作委员会——版本

gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0 版权所有 (C) 2017 Free Software Foundation, Inc. 这是免费软件;请参阅复制条件的来源。没有保修;甚至不是为了适销性或特定用途的适用性。

gcc -O0 -g -o helloworld -c helloworld.c

这是今天从头开始构建的全新系统。乌班图18.04。

生成一个 helloworld 文件,但如果我这样做并尝试运行它,则不可执行

$ chmod +x 你好世界

$ ./helloworld

bash: ./helloworld: 无法执行二进制文件: Exec 格式错误

不过,似乎编译我的大型项目没有任何问题。

尽管它是一个新系统,我重新安装了 gcc,但没有区别。

gcc compilation

5
推荐指数
1
解决办法
5361
查看次数

标签 统计

compilation ×1

gcc ×1