<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Qt with openEXR and the code crashed]]></title><description><![CDATA[<p dir="auto">Hi everyone.<br />
I'm writing an image viewer.<br />
For EXR, I've compiled the source code to get:<br />
bin, includes, libs and dlls.<br />
The openEXR is compiled in x64 and the version is 3.<br />
zlib is x64<br />
Imath is x64<br />
My Qt is x64 and the free version.</p>
<p dir="auto">In the pro file, I added:<br />
LIBS += -l$$PWD/openEXR/lib/Iex-3_1_d<br />
LIBS += -l$$PWD/openEXR/lib/IlmThread-3_1_d<br />
LIBS += -l$$PWD/openEXR/lib/Imath-3_1_d<br />
LIBS += -l$$PWD/openEXR/lib/OpenEXR-3_1_d<br />
LIBS += -l$$PWD/openEXR/lib/OpenEXRUtil-3_1_d<br />
INCLUDEPATH += $$PWD/openEXR/include/Imath<br />
INCLUDEPATH += $$PWD/openEXR/include/openEXR</p>
<p dir="auto">My test code:<br />
<strong>openexrloader.h</strong></p>
<pre><code>#ifndef OPENEXRLOADER_H
#define OPENEXRLOADER_H
#include &lt;QWidget&gt;
#include &lt;QtCore&gt;
#include &lt;QtGui&gt;
#include &lt;QImageIOPlugin&gt;
//Imath
#include &lt;half.h&gt;

//openEXR
#include &lt;OpenEXRConfig.h&gt;
#include &lt;ImfRgbaFile.h&gt;
#include &lt;ImfRgba.h&gt;
#include &lt;ImfArray.h&gt;

//Namespace
#include "namespaceAlias.h"
class openEXRLoader:QObject
{

public:
    explicit openEXRLoader();


    void writeRgba1 (const char fileName[],
                    const IMF::Rgba *pixels,
                    int width,
                    int height);
signals:

};
#endif // OPENEXRLOADER_H

</code></pre>
<p dir="auto"><strong>openexrloader.cpp</strong></p>
<pre><code>#include "openexrloader.h"

openEXRLoader::openEXRLoader():QObject()
{
    const char fileName[] = "D:/test.exr";
    //Declare a pointer in the memory for RGBA
    IMF::Rgba *pixels = NULL;
    int width = 100;
    int height = 100;

    try
    {
        writeRgba1(fileName, pixels, width, height);
    }
    catch (const std::exception &amp;exc)
    {
        std::cerr &lt;&lt; exc.what() &lt;&lt; std::endl;
    }
}

void openEXRLoader::writeRgba1 (const char fileName[],
            const IMF::Rgba *pixels,
            int width,
            int height)
{
    IMF::RgbaOutputFile file (fileName, width, height, IMF::WRITE_RGBA);      // 1
    file.setFrameBuffer (pixels, 1, width);                         // 2
    file.writePixels (height);                                      // 3
}
</code></pre>
<p dir="auto">NO errors, but the code will crash.</p>
<p dir="auto">Which part do I did it incorrectly?</p>
<p dir="auto">Thank you for help.</p>
]]></description><link>https://forum.qt.io/topic/127726/qt-with-openexr-and-the-code-crashed</link><generator>RSS for Node</generator><lastBuildDate>Sun, 21 Jun 2026 22:18:04 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127726.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Jun 2021 09:57:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt with openEXR and the code crashed on Fri, 18 Jun 2021 17:09:03 GMT]]></title><description><![CDATA[<p dir="auto">I've solved the problem.<br />
I forget to consider that .exe require .dlls to execute.<br />
Just copy .dlls to the folder where .exe is executed.</p>
]]></description><link>https://forum.qt.io/post/666152</link><guid isPermaLink="true">https://forum.qt.io/post/666152</guid><dc:creator><![CDATA[Sisqos]]></dc:creator><pubDate>Fri, 18 Jun 2021 17:09:03 GMT</pubDate></item><item><title><![CDATA[Reply to Qt with openEXR and the code crashed on Fri, 18 Jun 2021 15:39:39 GMT]]></title><description><![CDATA[<p dir="auto">I found IMF::RgbaOutputFile is the reason to make a crash.<br />
We knew FreeImage can work with Qt directly, but openEXR can't.<br />
Does anyone know the reason?</p>
]]></description><link>https://forum.qt.io/post/666139</link><guid isPermaLink="true">https://forum.qt.io/post/666139</guid><dc:creator><![CDATA[Sisqos]]></dc:creator><pubDate>Fri, 18 Jun 2021 15:39:39 GMT</pubDate></item><item><title><![CDATA[Reply to Qt with openEXR and the code crashed on Fri, 18 Jun 2021 09:58:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sisqos">@<bdi>Sisqos</bdi></a> said in <a href="/post/666077">Qt with openEXR and the code crashed</a>:</p>
<blockquote>
<p dir="auto">NO errors, but the code will crash.</p>
</blockquote>
<p dir="auto">If code crashes, run under the debugger, and look at the <em>stack trace</em> when it crashes.</p>
]]></description><link>https://forum.qt.io/post/666078</link><guid isPermaLink="true">https://forum.qt.io/post/666078</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 18 Jun 2021 09:58:16 GMT</pubDate></item></channel></rss>