gpt4 book ai didi

c++ - G++ 错误 ELF CLASS 错误

转载 作者:行者123 更新时间:2023-11-28 01:04:49 24 4
gpt4 key购买 nike

我试图在 Fedora 15 x64 上编译 C++ 程序。并得到错误:

./game: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory.

我在某处读到我需要做的就是安装 glibc.i686

我安装了它,现在即使在 g++ 中使用“-m64”选项后也会出现另一个错误

error while loading shared libraries: libplayer_1.so: wrong ELF class: ELFCLASS64

这是我的 makefile 的样子:

CONC_INC = ./include \
-I../include
APP = ./src/player_1.cxx


All :
g++ -m64 -Wall -g -fPIC -I$(CONC_INC) -c $(APP)
g++ -m64 -shared -W1 -o libplayer1.so.1.0 *.o
cp libplayer1.so.1.0 ../lib/libplayer_1.so.1.0
ln -sf ../lib/libplayer_1.so.1.0 ../lib/libplayer_1.so
ln -sf ../lib/libplayer_1.so.1.0 ../lib/libplayer_1.so.1
clean:
\rm -f *.so.* *.o

最佳答案

您遇到的原始问题表明 ./game 是一个 32 位动态链接的可执行文件,它无法运行,因为 32 位动态链接器 (/lib/ld-linux.so.2) 未安装;安装 32 位 glibc 包解决了这个问题。

如果 ./game 是一个需要 libplayer_1.so 作为动态库的 32 位可执行文件,如果 libplayer_1.so 是 64 位,这就是新错误告诉您的内容。

尝试将库构建为 32 位(-m32 而不是 -m64)。

关于c++ - G++ 错误 ELF CLASS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6809388/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com