C ld:警告:忽略文件

C ld:警告:忽略文件,c,file,C,File,这是我编译程序后的错误。在我的程序中,我只想在一个名为file的文件上打印80个字符 这是我的节目: ld: warning: ignoring file file, file was built for unsupported file format ( 0x70 0x6F 0x6A 0x61 0x0A 0x6F 0x64 0x6F 0x64 0x6F 0x6B 0x64 0x6F 0x6B 0x64 0x6F ) which is not the architecture being lin

这是我编译程序后的错误。在我的程序中,我只想在一个名为
file
的文件上打印80个字符

这是我的节目:

ld: warning: ignoring file file, file was built for unsupported file format ( 0x70 0x6F 0x6A 0x61 0x0A 0x6F 0x64 0x6F 0x64 0x6F 0x6B 0x64 0x6F 0x6B 0x64 0x6F ) which is not the architecture being linked (x86_64): file
#包括
#包括
#包括
#包括
#包括
#包括
无效打印字符(字符*路径)
{
int i;
int-fd;
char*buf;
fd=打开(路径,O_RDWR);
buf=malloc(sizeof(char)*80);
i=0;

虽然(buf[i]
文件
似乎是一个包含ASCII数据的文本文件,但为什么要尝试链接到它?编译和链接时使用的命令是什么?我使用gcc(带标志)-Werror-Wextra-Wall main.c print\u 80\u char.c文件我已经删除了用于编译的“文件”。
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>

void    print_80_char(char *path)
{
    int i;
    int fd;
    char *buf;

    fd = open(path, O_RDWR);
    buf = malloc(sizeof(char) * 80);
    i = 0;
    while (buf[i] <= 79)
    {
        read(fd, buf, 80);
        printf("%c", buf[i]);
        i++;
    }
}
#include <stdlib.h>

void print_80_char(char *path);

int main()
{
    print_80_char("file");
    return 0;
}