【问题标题】:ar cannot create archive: "File format not recognized"ar 无法创建存档:“文件格式无法识别”
【发布时间】:2013-07-27 19:20:53
【问题描述】:

我有这个makefile

libjackpot.a: jackport.o jackpot.o
    ar -rcs jackport.o jackpot.o

jackpot.o: jackpot.cpp jackpot.h
    g++ jackpot.cpp -std=c++11 -O2 -c

jackport.o: jackport.cpp jackpot.h jackport.h
    g++ jackport.cpp -std=c++11 -O2 -c

不知何故(在我的 Linux 机器上),我明白了

ar: jackport.o: File format not recognized

ar --help 给出

ar: supported targets: elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex

文件 jackport.o

jackport.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

【问题讨论】:

    标签: c++ unix-ar


    【解决方案1】:

    你需要为ar指定库名,例如:

       ar -rcs libjackpot.a jackport.o jackpot.o
    

    【讨论】:

    • 我怎么能错过
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-15
    • 1970-01-01
    • 1970-01-01
    • 2021-01-13
    • 2013-06-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多