Blessyn01
Blessyn01

Reputation: 3

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?

Upvotes: 0

Views: 926

Answers (1)

JonatanE
JonatanE

Reputation: 941

The -I flag adds the following directory to the include path of the compiler. This enables you to write e.g. #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 ...

Upvotes: 1

Related Questions