Closed qianlou closed 4 years ago
@qianlou At the bottom of https://github.com/homenc/HElib/blob/master/INSTALL.md it describes how to build your own project.
During the HElib build and install step you run cmake
(from HElib/build
) with the flag -DCMAKE_INSTALL_PREFIX=<helib install path>
to specify where you want to install HElib.
In your own project directory e.g. my_project
write a CMakeLists.txt
that is similar to the one in HElib/example_program
changing the necessary lines to be specific to your own test program. For example add_executable(my_program, my_program.cpp)
and target_link_libraries(my_program helib)
.
Then create a build directory local to your program and run cmake ..
with the flag -Dhelib_DIR=<helib install path>/share/cmake/helib
from my_project/build
.
Thanks for your help. This method works for me.
Your Contact: Your environment (OS/HW): Detailed Description: I can run the example_program/helib_example.cpp, but how can I run a other file. What do I need to learn? I am a beginner in Cmake. when I tried to use g++ to compile one .cpp file, I can generate the .o file, but I can't not generate executable file using command (g++ -std=c++17 -O2 -Wall -pthread binary_compare.o -o binary_compare -L /usr/local/helib_pack/lib -lntl -lgmp -lm -I /usr/local/helib_pack/include/helib/) because of link errors like( Test_binaryCompare.cpp:(.text+0x28f): undefined reference to > const&, std::vector<long, std::allocator > const&)'
)
ArgMap::parse(int, char**)' Test_binaryCompare.cpp:(.text+0x6d5): undefined reference to
FHEcontext::FHEcontext(unsigned long, unsigned long, unsigned long, std::vector<long, std::allocator