# libOPENFHEpke.dll not found in directory

**URL:** <https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649>\
**Category:** Library Questions\
**Tags:** questions\
**Created:** [October 16, 2024, 11:24am UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649 "2024-10-16T11:24:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![audobong](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@audobong](https://openfhe.discourse.group/u/audobong)\
**Post date:** [October 16, 2024, 11:24am UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/1 "2024-10-16T11:24:48Z")

</div>

Hello OpenFHE Team,

I am getting the following error when trying to execute my code on Windows.

xxxxx@xxx MINGW64 ~/OneDrive/Documents/FHE123/build  
$ ./simpleinteger.exe  
C:/Users/xxxxx/XXXX/Documents/FHE123/build/simpleinteger.exe: error while loading shared libraries: libOPENFHEpke.dll: cannot open shared object file: No such file or directory

I copied libOPENFHEpke.dll to the ‘lib’ folder in C:\home\xxxxx\build\lib but the problem persists.

I am using VSCode, and ran the following to arrive at this point  
mkdir build  
cd build/  
cmake …  
cmake --build . [At this point the libOPENFHEpke.dll.a and libOPENFHEpke.dll were  
not in the lib folder, so I copied the files there.]  
./simpleinteger.exe

I would appreciate your help because I have searched a lot of online materials but could not find any solution.

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [October 16, 2024, 12:33pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/2 "2024-10-16T12:33:54Z")

</div>

I have never worked with OpenFHE on native Windows, but I think you need to add the OpenFHE DLLs directory to the `PATH` environment variable.  
Try doing that in windows GUI, or you can try this command line:

> setx PATH “%PATH%;C:\path\to\your\openfhe\dll\directory”

---

<div class="post-metadata">

**Author:** ![audobong](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@audobong](https://openfhe.discourse.group/u/audobong)\
**Post date:** [October 16, 2024, 1:15pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/3 "2024-10-16T13:15:16Z")

</div>

Thank you so much. It worked.

---

<div class="post-metadata">

**Author:** ![audobong](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@audobong](https://openfhe.discourse.group/u/audobong)\
**Post date:** [March 3, 2025, 8:44am UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/4 "2025-03-03T08:44:08Z")

</div>

Hello OpenFHE Team.

I get the following error while at the linking phase of code compilation.  
xx@xx MINGW64 ~/OneDrive/Documents/crypt/build  
$ cmake --build .  
[2/2] Linking CXX executable reward2.exe  
FAILED: reward2.exe  
C:\WINDOWS\xxxxxx\cmd.exe /C “cd . && C:\msys64\mingw64\bin\c++.exe -Wall -Werror -O3 -DOPENFHE\_VERSION=1.2.0 -Wno-parentheses -DMATHBACKEND=4 -fopenmp -static CMakeFiles/reward2.dir/neward2.cpp.obj -o reward2.exe -Wl,–out-implib,libreward2.dll.a -Wl,–major-image-version,0,–minor-image-version,0 -LC:/PROGRA~2/OpenFHE/lib -fopenmp -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd .”  
C:/msys64/mingw64/bin/…/lib/gcc/x86\_64-w64-mingw32/13.2.0/…/…/…/…/x86\_64-w64-mingw32/bin/ld.exe: CMakeFiles/reward2.dir/neward2.cpp.obj:neward2.cp:(.text+0x1583): undefined reference to `blake2xb’

What could be the reason for an undefined reference error?

Thank you

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [March 3, 2025, 1:26pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/5 "2025-03-03T13:26:11Z")

</div>

Can you confirm you could build and install OpenFHE correctly following this [guide](https://openfhe-development.readthedocs.io/en/latest/sphinx_rsts/intro/installation/windows.html)?  
If so, did you use this [guide](https://openfhe-development.readthedocs.io/en/latest/sphinx_rsts/intro/building_user_applications.html) to build your user application `reward`?

---

<div class="post-metadata">

**Author:** ![audobong](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@audobong](https://openfhe.discourse.group/u/audobong)\
**Post date:** [March 3, 2025, 3:25pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/6 "2025-03-03T15:25:50Z")

</div>

Yes, I did. I have also successfully compiled other OpenFHE codes. In this code, I made some changes to the cmakelists file below shown below by editing set(CMAKE\_CXX\_STANDARD 20)

Also, I am trying use openFHE to encrypt between two arduino communication. I finally got to this point and I am getting this error.

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [March 3, 2025, 7:42pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/7 "2025-03-03T19:42:59Z")

</div>

If you keep the default `CMAKE_CXX_STANDARD` (17), do you still get the same error?

---

<div class="post-metadata">

**Author:** ![audobong](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@audobong](https://openfhe.discourse.group/u/audobong)\
**Post date:** [March 3, 2025, 7:56pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/8 "2025-03-03T19:56:13Z")

</div>

I have not tried that yet but I ran a similar OpenFHE library program with C++ Standard 20 and it compiled without errors

---

<div class="post-metadata">

**Author:** ![audobong](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@audobong](https://openfhe.discourse.group/u/audobong)\
**Post date:** [March 6, 2025, 2:46pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/9 "2025-03-06T14:46:16Z")

</div>

Hello Sir,  
I changed the standard back to 17 in cmakeLists.txt and made some changes to the code. The undefined error I am getting now is related to the twi.h file I included. It cannot see the other pair of twi.cpp while linking. On the other hand, it can see the OpenFHE link libraries from link\_directories( {OpenFHE\_LIBDIR} ) link\_directories( {OPENMP\_LIBRARIES} ).

How do I edit the cmakeLists.txt to make the compiler see other link directories?

Note: I already added the folder to the include directories in cmakeLists.txt.  
Thank you

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [March 6, 2025, 5:31pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/10 "2025-03-06T17:31:46Z")

</div>

It looks like your problem is a C++ and make issue. We cannot help you without code or detailed description of the problem.

Please follow the OpenFHE user application guide I referenced above. Also, review some material on how to set up a cmake C++ project.

---

<div class="post-metadata">

**Author:** ![audobong](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@audobong](https://openfhe.discourse.group/u/audobong)\
**Post date:** [March 6, 2025, 6:41pm UTC](https://openfhe.discourse.group/t/libopenfhepke-dll-not-found-in-directory/1649/11 "2025-03-06T18:41:51Z")

</div>

Sure, will do. Thank you
