Alanwyq 2013-11-11 11:13 采纳率: 0%
浏览 1565

RedHat企业版6.2中编译安装Qt4.8.5后,进入/tools/qvfb中gmake出现以下错误

有懂的人给看看是怎么回事,急求高手解答。错误如下:.obj/release-shared/qanimationwriter.o: In function QAnimationWriter::QAnimationWriter(QString const&, char const*)':
qanimationwriter.cpp:(.text+0x9ec): undefined reference to
png_create_write_struct'
qanimationwriter.cpp:(.text+0x9f7): undefined reference to png_create_info_struct'
qanimationwriter.cpp:(.text+0xa0d): undefined reference to
png_set_compression_level'
qanimationwriter.cpp:(.text+0xa2c): undefined reference to png_set_write_fn'
.obj/release-shared/qanimationwriter.o: In function
QAnimationWriterMNG::setImage(QImage const&)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG8setImageERK6QImage[QAnimationWriterMNG::setImage(QImage const&)]+0xb6): undefined reference to png_write_chunk'
.obj/release-shared/qanimationwriter.o: In function
QAnimationWriterMNG::write(png_struct_def*, unsigned char*, unsigned int)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG5writeEP14png_struct_defPhj[QAnimationWriterMNG::write(png_struct_def*, unsigned char*, unsigned int)]+0xd): undefined reference to `png_get_io_ptr'

注:在qanimationwriter.cpp中已包含且libpng库也已安装。

  • 写回答

1条回答

  • ChatGPTᴼᴾᴱᴺᴬᴵ 2024-03-20 23:20
    关注

    所有内容均由人工智能模型输出,其内容的准确性和完整性无法保证,不代表我的态度或观点。
    GLM-4在2024.02.27SuperCLUE基准得分榜单中排行第四https://www.superclueai.com/


    该回答引用GLM-4,仅提供参考,不保证完全正确
    目前为GLM-4(智谱清言)专栏,网页版本:未知(更新时间未知)
    如有图像,GLM-4将尝试识别您的图像
    出现这样的错误通常意味着在链接阶段找不到libpng库中定义的函数。尽管你提到已经在qanimationwriter.cpp中包含了libpng库,并且在系统中安装了libpng,但是在编译和链接时,编译器可能不知道要链接到哪个libpng库,或者库的路径可能没有正确设置。


    请按照以下步骤检查和解决问题:

    1. 确认libpng库已正确安装:确保libpng-devel(或相应的开发包)已安装在系统中。在Red Hat企业版6.2中,你可以使用yum来安装或检查:
      sudo yum install libpng-devel
      
    2. 检查库文件:确认libpng的库文件存在,并且位于你的库路径中。通常,libpng的库文件名为libpng.so,可能还有其他版本,例如libpng12.solibpng16.so。你可以使用locate命令来查找库文件的位置:
      locate libpng.so
      
    3. 检查链接参数:在编译Qt的时候,你需要确保链接器知道libpng库的位置。如果你使用的是qmake,那么可能需要在.pro文件中添加库的路径和名称。例如:
      LIBS += -L/path/to/libpng -lpng
      
      如果是手动编译,确保在gcc命令中包含了正确的库路径和-l参数:
      g++ ... -L/path/to/libpng -lpng ...
      
    4. 检查环境变量:确保LD_LIBRARY_PATH环境变量包含了libpng库的路径,这样在运行时可以找到库。你可以通过以下命令临时设置:
      export LD_LIBRARY_PATH=/path/to/libpng:$LD_LIBRARY_PATH
      
      或者永久添加到~/.bashrc~/.bash_profile中。
    5. 重新配置Qt:如果以上步骤都无法解决问题,你可能需要重新配置Qt的构建系统,确保它知道libpng库的位置。这通常涉及到运行configure脚本,并指定相关选项。
    6. 清理和重新构建:在修改了链接参数或安装了新的库之后,清理之前编译的文件,然后重新编译Qt:
      make clean
      make
      
    7. 检查链接器警告和错误:仔细检查编译和链接时的输出,看是否有关于libpng库的警告或错误。

    如果在尝试了上述步骤后问题仍未解决,请提供更多的编译命令和配置信息,以便进一步诊断问题。

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮