C ++链接器错误SDL图像-无法读取符号 [英] C++ Linker Error SDL Image - could not read symbols

查看:90
本文介绍了C ++链接器错误SDL图像-无法读取符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用SDL_Image库,并且已将.so添加到项目的链接库列表中(顺便说一下,我正在使用Code :: Blocks)。

I'm trying to use the SDL_Image library and I've added the .so to the link libraries list for my project (I'm using Code::Blocks, by the way).

这样做之后,当我去编译时,出现以下错误:

After doing this, when I go to compile, I get this error:

Linking console executable: bin/Debug/ttfx
/usr/lib32/libSDL_image-1.2.so: could not read symbols: File in wrong format

这是什么意思,我如何使它工作?

What does this mean and how can I get it working?

编辑:我正在使用gcc。

I'm using gcc.

谢谢!

推荐答案

在链接步骤中,存在不兼容的情况,因为某些目标文件是编译为32位,有些则为64位。查看其路径 libSDL_image.so 可能是针对32位编译的。

During the linking step there are incompatibilities since some of your object files were compiled for 32-bit and some for 64-bit. Looking at its path libSDL_image.so was probably compiled for 32-bit.

如果使用GNU编译器,请添加 -m32 到您的 CXXFLAGS ,也可以将对象编译为32位。

If you use the GNU compiler add -m32 to your CXXFLAGS to compile your objects for 32-bit, too.

这篇关于C ++链接器错误SDL图像-无法读取符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆