Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc error: wrong ELF class: ELFCLASS64

Tags:

gcc

makefile

I was trying to compile a program using an external compiled object coreset.o. I wrote the public01.c test file and my functions are in computation.c, both of which compiles. However its failing on linking it together. What might be the problem?

gcc -o public01.x public01.o computation.o coreset.o ld: fatal: file coreset.o: wrong ELF class: ELFCLASS64 ld: fatal: File processing errors. No output written to public01.x collect2: ld returned 1 exit status 
like image 911
zxcv Avatar asked Oct 19 '08 04:10

zxcv


1 Answers

I think that coreset.o was compiled for 64-bit, and you are linking it with a 32-bit computation.o.

You can try to recompile computation.c with the '-m64' flag of gcc(1)

like image 148
Christian C. Salvadó Avatar answered Sep 21 '22 15:09

Christian C. Salvadó