Question

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
Was it helpful?

Solution

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

   ar -rcs libjackpot.a jackport.o jackpot.o
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top