<p>All the previous answers/comments were correct. The weird thing about my case was the symlinks of the libraries in the <code>build</code> directory were not valid and were not pointing to the right files. The output of <code>ls -lh /home/Warrior/Desktop/pathtracer/oidn/build</code> was as follow:</p>
<pre><code>total 160K
drwxrwxr-x 4 amir amir 4.0K Feb  4 00:09 apps
-rw-rw-r-- 1 amir amir  19K Feb  4 00:09 CMakeCache.txt
drwxrwxr-x 7 amir amir 4.0K Feb  4 00:09 CMakeFiles
-rw-rw-r-- 1 amir amir 6.5K Feb  4 00:09 cmake_install.cmake
drwxrwxr-x 3 amir amir 4.0K Feb  4 00:09 common
-rw-r--r-- 1 amir amir 3.6K Feb  4 00:09 CPackConfig.cmake
-rw-r--r-- 1 amir amir 4.0K Feb  4 00:09 CPackSourceConfig.cmake
-rw-rw-r-- 1 amir amir 103K Feb  4 00:09 Makefile
drwxrwxr-x 3 amir amir 4.0K Feb  4 00:08 mkl-dnn
-rw-r--r-- 1 amir amir 1.6K Feb  4 00:09 OpenImageDenoiseConfigVersion.cmake
</code></pre>
<p>But when I would go to the directory I would see the following:</p>
<p><a href="https://i.sstatic.net/8PzFE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8PzFE.png" alt="enter image description here" /></a></p>
<p>What I did was instead of cloning the oidn repo somewhere else and building it, I cloned the oidn repo in <code>/home/Warrior/Desktop/pathtracer/</code> and built it there. After that I could see the correct file names/symlinks via <code>ls -lh</code> as follow. Now my program compiles and things work fine. I just had to use <code>LIBS += -L&quot;oidn/build/&quot; -lOpenImageDenoise</code> when compiling my code:</p>
<pre><code>total 51M
drwxrwxr-x 4 amir amir 4.0K Feb  9 10:14 apps
-rw-rw-r-- 1 amir amir  19K Feb  9 10:14 CMakeCache.txt
drwxrwxr-x 7 amir amir 4.0K Feb  9 10:19 CMakeFiles
-rw-rw-r-- 1 amir amir 5.6K Feb  9 10:14 cmake_install.cmake
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 color_ispc_avx2.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 color_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 3.1K Feb  9 10:17 color_ispc.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 color_ispc_sse4.h
drwxrwxr-x 3 amir amir 4.0K Feb  9 10:14 common
-rw-r--r-- 1 amir amir 3.3K Feb  9 10:14 CPackConfig.cmake
-rw-r--r-- 1 amir amir 3.7K Feb  9 10:14 CPackSourceConfig.cmake
-rw-rw-r-- 1 amir amir 2.6K Feb  9 10:17 input_reorder_ispc_avx2.h
-rw-rw-r-- 1 amir amir 2.6K Feb  9 10:17 input_reorder_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 3.1K Feb  9 10:17 input_reorder_ispc.h
-rw-rw-r-- 1 amir amir 2.6K Feb  9 10:17 input_reorder_ispc_sse4.h
-rw-rw-r-- 1 amir amir  41K Feb  9 10:14 libcommon.a
-rw-rw-r-- 1 amir amir  16M Feb  9 10:17 libdnnl.a
lrwxrwxrwx 1 amir amir   24 Feb  9 10:19 libOpenImageDenoise.so -&gt; libOpenImageDenoise.so.0
lrwxrwxrwx 1 amir amir   28 Feb  9 10:19 libOpenImageDenoise.so.0 -&gt; libOpenImageDenoise.so.1.3.0
-rwxrwxr-x 1 amir amir  34M Feb  9 10:19 libOpenImageDenoise.so.1.3.0
-rw-rw-r-- 1 amir amir  37K Feb  9 10:19 libutils.a
drwxrwxr-x 2 amir amir 4.0K Feb  9 10:17 local__core
-rw-rw-r-- 1 amir amir 104K Feb  9 10:14 Makefile
drwxrwxr-x 3 amir amir 4.0K Feb  9 10:14 mkl-dnn
-rwxrwxr-x 1 amir amir 181K Feb  9 10:19 oidnBenchmark
-rwxrwxr-x 1 amir amir  59K Feb  9 10:19 oidnDenoise
-rwxrwxr-x 1 amir amir 882K Feb  9 10:19 oidnTest
-rw-r--r-- 1 amir amir 1.6K Feb  9 10:14 OpenImageDenoiseConfigVersion.cmake
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 output_copy_ispc_avx2.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 output_copy_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 1.9K Feb  9 10:17 output_copy_ispc.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 output_copy_ispc_sse4.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 output_reorder_ispc_avx2.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 output_reorder_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 3.1K Feb  9 10:17 output_reorder_ispc.h
-rw-rw-r-- 1 amir amir 2.5K Feb  9 10:17 output_reorder_ispc_sse4.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 upsample_ispc_avx2.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 upsample_ispc_avx512skx.h
-rw-rw-r-- 1 amir amir 1.8K Feb  9 10:17 upsample_ispc.h
-rw-rw-r-- 1 amir amir 1.5K Feb  9 10:17 upsample_ispc_sse4.h
drwxrwxr-x 2 amir amir 4.0K Feb  9 10:17 weights
</code></pre>

CC BY-SA 4.0
2021-02-10T14:34:29.107Z
2021-02-10T14:34:29.107Z
Amir
<p>I've been trying to link my the Intel Open Image Denoise libraries for about a week and still have no luck as of now. This could partly be because I am also novice in C++ stuff. So I need some help in getting it to work.</p>
<p>Here's what I've done so far: after compiling OIDN I moved the oidn directory to the directory where my path tracer code is and did the following in my code (C++11) which I'm working on in Qt Creator.</p>
<pre><code>#include &quot;oidn/include/OpenImageDenoise/oidn.hpp&quot;
.
.
.
oidn::DeviceRef device = oidn::newDevice(); // this is where things break
device.commit();
</code></pre>
<p>Note that doing <code>#include &quot;oidn/include/OpenImageDenoise/oidn.hpp&quot;</code> seems to work fine because autocomplete works for oidn and shows its members. However I get the following errors which seems to be due to not linking oidn libraries.</p>
<p><a href="https://i.sstatic.net/tyl6q.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tyl6q.png" alt="enter image description here" /></a></p>
<p>I tried linking the libraries via <code>LIBS += -L&quot;oidn/build/&quot;</code> or <code>LIBS += -L&quot;oidn/build/libOpenImageDenoise.so&quot;</code> (as shown in the image) but I get the same errors. I also appended <code>-loidn</code> but got an error saying <code>&quot;cannot find -loidn&quot;</code>. I am now pretty confused on what I'm supposed to do. I'm not even sure if the errors are due to not properly linking libraries because I see people generally link libraries in C++ the same way I am trying to do it here. I would really appreciate if someone can help me figure out what I need to do to get OIDN work.</p>

CC BY-SA 4.0
2021-02-10T07:23:50.510Z
maybe not that helpful but does -lOpenImageDenoise -L"oidn/build/" make any difference ? Usually -lXXX matches with a libXXX.so file. -L is for setting the search directory and should not be used to reference a library directly
PaulHK
CC BY-SA 4.0
2021-02-10T14:35:36.457Z
@PaulHK You're correct but the issue I was experiencing had something to do with the file system. The file system had not registered many of the files and that's why the compiler couldn't find them
Amir
<raytracing><rendering><pathtracing><c++><denoise>
How to link Intel Open Image Denoise in Qt Creator and use it to denoise noisy Monte Carlo path tracing renderings?
Amir
# How to link Intel Open Image Denoise in Qt Creator and use it to denoise noisy Monte Carlo path tracing renderings?

(Asked by: username_0 on 2021-02-02)

I've been trying to link my the Intel Open Image Denoise libraries for about a week and still have no luck as of now. This could partly be because I am also novice in C++ stuff. So I need some help in getting it to work.

Here's what I've done so far: after compiling OIDN I moved the oidn directory to the directory where my path tracer code is and did the following in my code (C++11) which I'm working on in Qt Creator.

```
#include "oidn/include/OpenImageDenoise/oidn.hpp"
.
.
.
oidn::DeviceRef device = oidn::newDevice(); // this is where things break
device.commit();

```

Note that doing `#include "oidn/include/OpenImageDenoise/oidn.hpp"` seems to work fine because autocomplete works for oidn and shows its members. However I get the following errors which seems to be due to not linking oidn libraries.

[![enter image description here](https://i.sstatic.net/tyl6q.png)](https://i.sstatic.net/tyl6q.png)

I tried linking the libraries via `LIBS += -L"oidn/build/"` or `LIBS += -L"oidn/build/libOpenImageDenoise.so"` (as shown in the image) but I get the same errors. I also appended `-loidn` but got an error saying `"cannot find -loidn"`. I am now pretty confused on what I'm supposed to do. I'm not even sure if the errors are due to not properly linking libraries because I see people generally link libraries in C++ the same way I am trying to do it here. I would really appreciate if someone can help me figure out what I need to do to get OIDN work.

**Tags:** raytracing, rendering, pathtracing, c++, denoise

> **Comments:**
> **username_1**: maybe not that helpful but does -lOpenImageDenoise -L"oidn/build/" make any difference ? Usually -lXXX matches with a libXXX.so file. -L is for setting the search directory and should not be used to reference a library directly  
> **username_0**: @username_1 You're correct but the issue I was experiencing had something to do with the file system. The file system had not registered many of the files and that's why the compiler couldn't find them  

---

## 1 answers

### Answer by username_0 on 2021-02-10. Score: 0 | Accepted answer

All the previous answers/comments were correct. The weird thing about my case was the symlinks of the libraries in the `build` directory were not valid and were not pointing to the right files. The output of `ls -lh /home/Warrior/Desktop/pathtracer/oidn/build` was as follow:

```
total 160K
drwxrwxr-x 4 username_0 username_0 4.0K Feb  4 00:09 apps
-rw-rw-r-- 1 username_0 username_0  19K Feb  4 00:09 CMakeCache.txt
drwxrwxr-x 7 username_0 username_0 4.0K Feb  4 00:09 CMakeFiles
-rw-rw-r-- 1 username_0 username_0 6.5K Feb  4 00:09 cmake_install.cmake
drwxrwxr-x 3 username_0 username_0 4.0K Feb  4 00:09 common
-rw-r--r-- 1 username_0 username_0 3.6K Feb  4 00:09 CPackConfig.cmake
-rw-r--r-- 1 username_0 username_0 4.0K Feb  4 00:09 CPackSourceConfig.cmake
-rw-rw-r-- 1 username_0 username_0 103K Feb  4 00:09 Makefile
drwxrwxr-x 3 username_0 username_0 4.0K Feb  4 00:08 mkl-dnn
-rw-r--r-- 1 username_0 username_0 1.6K Feb  4 00:09 OpenImageDenoiseConfigVersion.cmake

```

But when I would go to the directory I would see the following:

[![enter image description here](https://i.sstatic.net/8PzFE.png)](https://i.sstatic.net/8PzFE.png)

What I did was instead of cloning the oidn repo somewhere else and building it, I cloned the oidn repo in `/home/Warrior/Desktop/pathtracer/` and built it there. After that I could see the correct file names/symlinks via `ls -lh` as follow. Now my program compiles and things work fine. I just had to use `LIBS += -L"oidn/build/" -lOpenImageDenoise` when compiling my code:

```
total 51M
drwxrwxr-x 4 username_0 username_0 4.0K Feb  9 10:14 apps
-rw-rw-r-- 1 username_0 username_0  19K Feb  9 10:14 CMakeCache.txt
drwxrwxr-x 7 username_0 username_0 4.0K Feb  9 10:19 CMakeFiles
-rw-rw-r-- 1 username_0 username_0 5.6K Feb  9 10:14 cmake_install.cmake
-rw-rw-r-- 1 username_0 username_0 2.5K Feb  9 10:17 color_ispc_avx2.h
-rw-rw-r-- 1 username_0 username_0 2.5K Feb  9 10:17 color_ispc_avx512skx.h
-rw-rw-r-- 1 username_0 username_0 3.1K Feb  9 10:17 color_ispc.h
-rw-rw-r-- 1 username_0 username_0 2.5K Feb  9 10:17 color_ispc_sse4.h
drwxrwxr-x 3 username_0 username_0 4.0K Feb  9 10:14 common
-rw-r--r-- 1 username_0 username_0 3.3K Feb  9 10:14 CPackConfig.cmake
-rw-r--r-- 1 username_0 username_0 3.7K Feb  9 10:14 CPackSourceConfig.cmake
-rw-rw-r-- 1 username_0 username_0 2.6K Feb  9 10:17 input_reorder_ispc_avx2.h
-rw-rw-r-- 1 username_0 username_0 2.6K Feb  9 10:17 input_reorder_ispc_avx512skx.h
-rw-rw-r-- 1 username_0 username_0 3.1K Feb  9 10:17 input_reorder_ispc.h
-rw-rw-r-- 1 username_0 username_0 2.6K Feb  9 10:17 input_reorder_ispc_sse4.h
-rw-rw-r-- 1 username_0 username_0  41K Feb  9 10:14 libcommon.a
-rw-rw-r-- 1 username_0 username_0  16M Feb  9 10:17 libdnnl.a
lrwxrwxrwx 1 username_0 username_0   24 Feb  9 10:19 libOpenImageDenoise.so -> libOpenImageDenoise.so.0
lrwxrwxrwx 1 username_0 username_0   28 Feb  9 10:19 libOpenImageDenoise.so.0 -> libOpenImageDenoise.so.1.3.0
-rwxrwxr-x 1 username_0 username_0  34M Feb  9 10:19 libOpenImageDenoise.so.1.3.0
-rw-rw-r-- 1 username_0 username_0  37K Feb  9 10:19 libutils.a
drwxrwxr-x 2 username_0 username_0 4.0K Feb  9 10:17 local__core
-rw-rw-r-- 1 username_0 username_0 104K Feb  9 10:14 Makefile
drwxrwxr-x 3 username_0 username_0 4.0K Feb  9 10:14 mkl-dnn
-rwxrwxr-x 1 username_0 username_0 181K Feb  9 10:19 oidnBenchmark
-rwxrwxr-x 1 username_0 username_0  59K Feb  9 10:19 oidnDenoise
-rwxrwxr-x 1 username_0 username_0 882K Feb  9 10:19 oidnTest
-rw-r--r-- 1 username_0 username_0 1.6K Feb  9 10:14 OpenImageDenoiseConfigVersion.cmake
-rw-rw-r-- 1 username_0 username_0 1.5K Feb  9 10:17 output_copy_ispc_avx2.h
-rw-rw-r-- 1 username_0 username_0 1.5K Feb  9 10:17 output_copy_ispc_avx512skx.h
-rw-rw-r-- 1 username_0 username_0 1.9K Feb  9 10:17 output_copy_ispc.h
-rw-rw-r-- 1 username_0 username_0 1.5K Feb  9 10:17 output_copy_ispc_sse4.h
-rw-rw-r-- 1 username_0 username_0 2.5K Feb  9 10:17 output_reorder_ispc_avx2.h
-rw-rw-r-- 1 username_0 username_0 2.5K Feb  9 10:17 output_reorder_ispc_avx512skx.h
-rw-rw-r-- 1 username_0 username_0 3.1K Feb  9 10:17 output_reorder_ispc.h
-rw-rw-r-- 1 username_0 username_0 2.5K Feb  9 10:17 output_reorder_ispc_sse4.h
-rw-rw-r-- 1 username_0 username_0 1.5K Feb  9 10:17 upsample_ispc_avx2.h
-rw-rw-r-- 1 username_0 username_0 1.5K Feb  9 10:17 upsample_ispc_avx512skx.h
-rw-rw-r-- 1 username_0 username_0 1.8K Feb  9 10:17 upsample_ispc.h
-rw-rw-r-- 1 username_0 username_0 1.5K Feb  9 10:17 upsample_ispc_sse4.h
drwxrwxr-x 2 username_0 username_0 4.0K Feb  9 10:17 weights

```


---

