本文介绍了gcc错误:错误的ELF类:ELFCLASS64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用外部编译对象coreset.o来编译程序。我写了public01.c测试文件,我的函数在comput.c中,两者都编译。然而它没有把它连接在一起。可能是什么问题?
gcc -o public01.x public01.o comput.o coreset.o
ld :fatal:文件coreset.o:错误的ELF类:ELFCLASS64
ld:fatal:文件处理错误。没有输出写入public01.x
collect2:ld返回1退出状态
解决方案我认为coreset.o是为64位编译的,而且你正在使用32位计算来链接它。
你可以尝试使用 gcc(1)标志重新编译computes.c / a>
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
解决方案
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)
这篇关于gcc错误:错误的ELF类:ELFCLASS64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!