在使用LibVLC+Qt包装食品播放器时遇到一个匪夷所思的问题,Debug下运行的很好,Release下初始化VLC便崩溃。

终于在Stack Overflow找到了问题的解决方案。

问题内容摘录如下:

问题:  fixing libvlc release mode crash with VC2010

描述:  I am using libVLC in one of my apps which I am compiling with VC2010 (also tried VC2008), the debug mode of my app works great but as soon as I compile to release mode and try to call into libVLC I get a crash. I asked for help on the vlc forums and someone mentioned this usually points to calling convention differences, however I am not sure what to check to see if this is the case or more importantly how to fix it.

some notes:

I am compiling libVLC using Ubuntu and following the how to guides on the libVLC wiki.
I'm using libVLC inside a C++ file.
I've tried compiling libVLC with and without debugging information.
I've tried calling libvlc_get_version and libvlc_new as my first call, both crash.
Even though I do not have symbols in my release version, I can see the call stack and it is definitely getting messed up as it is showing functions in the stack that are never-ever called which seems to indicate the wrong calling convention but again I'm not sure how to check/fix this.

I'm not sure if it is related but another issue I am having with libvlc is that I am trying to delay load the dll (have tried not doing this for the above problem but it didnt make a difference), i'm adding the linker flags: /DELAYLOAD:libvlc.dll /DELAYLOAD:libvlccore.dll , but when the linking occurs I get these warnings:

LINK : warning LNK4199: /DELAYLOAD:libvlc.dll ignored; no imports found from libvlc.dll
LINK : warning LNK4199: /DELAYLOAD:libvlccore.dll ignored; no imports found from libvlccore.dll
However it is definitely linking to the lib and requiring the dll as seen with Dependency Walker (not to mention I am calling into it).. again not sure if this is related but wanted to throw it out there as well.

I appreciate any advice/help on this one. Thanks!

解决办法一:

adding /INCREMENTAL to linker flags

解决办法二:

set Linker\Optimization\References to No (/OPT:NOREF)

一个比较好的问题解释:

I just came to the same problem and after some digging up with IDA dissasembler I've found out that linker throws out all libvlc imports. And yes INCREMENTAL flags adds them back in but as you said it's not the explanation of the problem.

Now I had a similar occurrence when designing a driver where Release eliminated function pointers and strings. And the solution was to set Linker\Optimization\References to No (/OPT:NOREF). So then linker leaves in all references even if it thinks they are not used.

And of course that fixes the problem.

So another mystery solved.

Best regards Waldemar

我用方法二顺利解决了问题。

LibVLC+Qt调用libvlc_new在Debug下正确运行Release下崩溃(VS2008)相关推荐

  1. debug版没有问题而release版本崩溃的解决方法探究

    测试人员提了一个bug,用代码没有重现,找到release版本却重现了,排除不同日期不同版本的问题,在最新代码下调试发现,在debug下没有问题,而在release下回崩溃.对于菜鸟的我来说一脸懵逼, ...

  2. Release下报错,Debug下正常原因总结

    首先介绍如何在Release模式下调试: 步骤如下:         说明:ASSERT宏在发行版本中不起作用,而应该用VERIFY来进行发行版的调试.如果发行版本运行有问题,可以先禁止所有代码优化再 ...

  3. win10环境下VTK7.1的编译和Qt调用VTK的详细教程二(VS2013编译支持Qt的VTK库)

    本文主要用于编译支持Qt的VTK库,重点在于编译VTK库,供Qt调用. 第1步:新建一个文件夹:vtkDir 第2步:在该文件夹下新建两个文件夹vtk_bin.vtk_src 第3步:将下载好的VTK ...

  4. linux python qt 安装目录,Linux 下QT调用Python库文件 以及Linux 安装Python3.8开发环境 问题...

    最近想运用linux系统下Qt来实现c++ 与python的混合编程,linux系统会自带python2.7版本或者python3.5版本(深度linux). Qt调用python文件需要在pro文件 ...

  5. 如何在LINUX下利用QT调用第三方软件WPS

    如何在LINUX下利用QT调用第三方软件WPS 前言: 在开发过程中,客户需要一个在线查看功能,能够打开WORD.PDF的文件,并且显示在屏幕上,需要调用第三方软件WPS来实现这个功能. 技术点: 1 ...

  6. qt调用linux系统的线程函数吗,Qt之主线程与子线程通讯(linux下)

    Qt之主线程与子线程通信(linux下) 转载请注明出处:http://blog.csdn.net/feng1790291543 主线程与子线程通信主要是通过Qt上的Gui按钮,触发使得主线程上的信息 ...

  7. qt调用opencv汇总(2)

    OpenCV3.4.3+Qt5.9.4(QtCreator)开发环境搭建 之前有过对OpenCV3.4.2+VS2015编译及环境搭建,今天使用OpenCV3.4.3+QtCreator5.9.4编译 ...

  8. Qt调用OpenCV汇总(1)

    //************************************************************************************************** ...

  9. QT调用python文件

    QT调用python文件 基本步骤 1.将python文件要是使用的环境添加到环境变量中 2.新建一个QT项目 3.在.pro文件中加入需要的python库文件目录 右击项目名,然后单击"添 ...

最新文章

  1. flannel源码分析--LookupExtIface
  2. 汇编语言--单步中断
  3. python3导入特定的成员
  4. The Moving Points
  5. [python进阶]11接口:从协议到抽象基类
  6. [html] 请使用一个div写出有三条横线的小图标
  7. 我为什么用GO语言来做区块链?
  8. python| map()函数应用详解
  9. PMBOK--项目整合管理
  10. 图论及其应用 2017年期末考试 答案总结
  11. 怎么把cad转化为jpg图片
  12. 心跳检测,用oob实现
  13. 信息安全的CIA三要素
  14. VLC 官方文档地址
  15. vce 题库导入_PDF 题库转VCE 文件
  16. 安卓相机camera2开发知识点
  17. 【蓝桥杯选拔赛真题40】Scratch跳格子 少儿编程scratch蓝桥杯选拔赛真题讲解
  18. 计算机技术在机械设计中的应用,计算机技术在机械设计制造及其自动化中的应用...
  19. Go C画图 CSP-J CSP-S 信息学奥赛 2023.01.10 测试题
  20. CentOS7-搭建Ftp服务

热门文章

  1. 最安全的加密算法 Bcrypt,再也不用担心数据泄密了~
  2. 5G/NR 随机接入过程之Msg3
  3. 集合论悖论的一点思考
  4. 14.python-面向对象
  5. java SQL查询语句
  6. python pyecharts绘制地图
  7. 奇舞javaScript BOM DOM - 笔记
  8. 美国低速自动驾驶应用案例 | 自动驾驶系列
  9. apache zip解压,使用org.apache.tools.zip实现zip压缩和解压
  10. c++中的main函数