Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ar cannot create archive: "File format not recognized"

Tags:

c++

unix-ar

I have this 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

Somehow (on my Linux box), I get

ar: jackport.o: File format not recognized

ar --help gives

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

file jackport.o

jackport.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
like image 436
user877329 Avatar asked Jul 27 '13 19:07

user877329


People also ask

Why does it say file format not recognized?

Because the system cannot find the file, it responded with the "format not recognized" messaged. The solution: Provide the full path name withen identifying the file during the upload process. Ensure your document is a PDF document.

What format are ar files?

Description. The ar (archive) file format combines several files into one. The ar command creates an archive file. The ld (link editor) command searches archive files to resolve program linkage.


1 Answers

You need to specify the library name for ar, e.g.:

   ar -rcs libjackpot.a jackport.o jackpot.o
like image 68
malenkiy_scot Avatar answered Sep 18 '22 02:09

malenkiy_scot