Output is not generated when executing simple-integers.cpp


I installed OpenFHE from stable branch ( v 1.0.4 ) and executed unit tests using “make testall”, all cases were passed. I tried to build and execute simple-integers.cpp as per the instructions in README file available in “openfhe-development\src\pke\examples” path. “make” command has created the the build without any errors, but when i try to run it no output is displayed. I checked the code simple-integers.cpp and it does have cout statments. I am not sure what i am missing here and would appreciate any help.
Attached screenshots for reference.

simple-integers should be in build/bin/examples/pke/simple-integers

You should not run build target test. after make testall there should be a build/unittest directory with three gtest executables for core, pke and binfhe.

I was analyzing how to run code in OpenFHE, so instead of writing code of my own i choose one of the .cpp file provided as examples to see how it executes.
In order to check this i copied simple-integers.cpp to a new directory “my_work” and tried to run this after make was successfully completed.

I attached make testall screenshot just to show that installation of OpenFHE is good.

My main question here is how i can execute my own code ? which location should i should place the file and steps to be followed.

We recommend build/install OpenFHE on your system, then build your application in another directory using the approach listed here: “building_user_applications”

That separates your cmake files from the complicated cmake files of the OpenFHE build process, and is much less error prone.

Sorry, if i am confusing you are not being clear. I have installed OpenFHE on my system and follwed the steps mentioned in “building_user_applications”.
I created my_work folder as my project and followed the steps 3 to 8. Step 8 created my build named test, how do i execute it now? ( i tried ./test )

Hi @Poojitha, did you solve the problem of running your own program? If yes, great :+1:. And if not, then I’ll try to help you based on my understanding.

Hi Ali,

Thank you for response. I am still having problem running my program. I have created new directory and followed instructions specified in “building_user_applications”. But not getting any output and there aren’t any errors while executing cmake or make command. It would be really wonderful if you can help me with this.
Attaching cmake file, .cpp file and output screenshots

@s_ali please do let me know if you need any other info from my end

@Poojitha since things are working on my Ubuntu machine, therefore, I thought it should be easy to do the same on Windows machine but I was wrong. So far, I am having on luck in finding the the reason and like you, I’m also having no output on screen after running the program on Windows.

For the time being – may be not recommended by OpenFHE developers/contributors, I would suggest to safe your program in the sub-directory of src e.g., safe your sample.cpp in ./openfhe-development/src/pke/examples/. Next to build your program, go to ./openfhe-development/build/ and run make allpkeexamples. Finally, to run your program run ./bin/examples/pke/sample.

I hope this could solve your problem of running your own program for time being. If I could solve the no output on screen in Windows, then I’ll update you.

@s_ali Thank you i will try the suggested solution for now, hope we can figure this out.

Hi @Poojitha, @s_ali

I would like to confirm. Are you seeing an issue running a test program based on simple-integers.cpp in a user project when using MingGW? I want to try recreating it.

Another question. Did you try it using the main branch (latest pre-release), i.e., v1.1.1? I see a MinGW-specific fix in the issues/PRs for v1.1.0. Maybe it is already fixed in v1.1.x?


Hi @ypolyakov

I have tried running test program based on simple-integers.cpp as well as simple-real-numbers.cpp following the instructions specified in “building_user_applications”. My intension was to test the steps mentioned in the document.

I have used stable branch (v1.0.4) to clone, haven’t tried main branch.

Thank you in advance!

Hi @ypolyakov,

Yes, I’m still having no output on screen using simple-integers.cpp in a user project when using MingGW. On the other hand, after setting export PATH=$PATH:lib and running ./bin/examples/pke/simple-integers from /openfhe-development/build, I get output on screen.

Yes, I’m using the main branch and the log is showing the latest commit 4ebb28ea7bdd894a73bc5b73e59fcfbc78253308 on Fri Sep 8 12:30:29 2023. Sorry, I don’t know how to check/confirm the version number i.e., v1…

Confirming that there is no output on the screen. I will open a bug ticket and investigate the issue.

HI @Poojitha,
In order to run ./test.exe you should add the absolute path to the location of the openfhe libraries to PATH. I guess that you didn’t run “make install” and used the libraries directly from ~/openfhe-development/build/lib.
In this case you should run from the command line: export PATH=/home/pooji/openfhe-development/build/lib:${PATH}
After that you can run ./test.exe and it should produce an output

1 Like

Sounds like the issue is solved. @Poojitha and @s_ali can you confirm if what @dsuponitskiy-duality suggested addressed the problem?

1 Like

Hi @dsuponitskiy-duality,

Suggested solution worked for me. Thank you for helping!!

i am glad to hear this

Hi @dsuponitskiy-duality,

Thanks! The suggested solution works.