7

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
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user877329
  • 6,717
  • 8
  • 46
  • 88

1 Answers1

11

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

   ar -rcs libjackpot.a jackport.o jackpot.o
malenkiy_scot
  • 16,415
  • 6
  • 64
  • 87