简体   繁体   中英

Error message while compiling a program

I'm a newbie to C++ and Linux. There is this code I'm playing with that requires me to install the HElib (Homomorphic encryption library and other libraries - GMP, NTL) which I did. I want to compile the code ( main.cpp ) that has a header file ( FHE.h ) in HElib. My problem is how can I link FHE.h (in HElib folder) and main.cpp (in another folder) together so that I can compile them. I have tried some commands

g++ -I/Home/HElib/src/FHE.h main.cpp -o main 

Error message

main.cpp:1:17: fatal error: FHE.h: No such file or directory
compilation terminated.

Another command line

g++ -I/Home/HElib/Src/FHE.h -I/Home/SimpleFHESum-master/SimpleFHESum-master/main.cpp -o main]

Error Message

g++: fatal error: no input files
compilation terminated.

What's wrong and how can I fix this?

The -I flag adds the following directory to the include path of the compiler. This enables you to write eg #include "FHE.h" even though that file is not located in the same folder as the source file you're trying to compile.

Have you tried just removing the 'FHE.h' part from your -I directive?

g++ -I/Home/HElib/src ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM