0

The libraries that I've used so far require installation. So they generate xx.a file that can be included in the code in cygwin. However, NTL library for windows only requires to unzip the file. So I need to know how to use it in cygwin command line. I have done #include in the code. The problem is in include directory in NTL all files are " .h".

What I have done is:

g++  -c  Polynomial.cpp -L/cygdrive/c/cygwin/home/Win7/libpaillier -  
l:libpaillier.a -L/cygdrive/c/cygwin/home/Win7/Cryptopp -l:libcryptopp.a   -
L/cygdrive/c/cygwin/home/Win7/WinNTL-9_2_0/include/NTL -lgmpxx -lgmp

but I get below error:

fatal error: NTL/ZZ.h: No such file or directory
#include <NTL/ZZ.h>
                ^
compilation terminated.

It'd be great if someone give me a clue. TBC: I have already installed GMP and been using it.

Adrian
  • 51
  • 7

1 Answers1

2

In gcc path to headers location is specified with -I switch. With -L you define paths to compiled libraries location (directories with .a or .so files).

Also if full path to zz.h is /cygdrive/c/cygwin/home/Win7/WinNTL-9_2_0/include/NTL/zz.h then NTL should not be included in path specified in gcc arguments.

So, you need at least to replace

-L/cygdrive/c/cygwin/home/Win7/WinNTL-9_2_0/include/NTL

with

-I/cygdrive/c/cygwin/home/Win7/WinNTL-9_2_0/include

and maybe for others libraries as well and add paths to compiled libraries locations with -L where they are needed.

dewaffled
  • 2,850
  • 2
  • 17
  • 30
  • I've done that. I keep getting this error: " fatal error: zz.h: No such file or directory. #include ^ compilation terminated. " – Adrian Jun 08 '15 at 13:40
  • 1
    If full path to `zz.h` is `/cygdrive/c/cygwin/home/Win7/WinNTL-9_2_0/include/NTL/zz.h` then `NTL` should not be included in path specified in gcc arguments. I updated answer. – dewaffled Jun 08 '15 at 13:47
  • I have put the below command line that successfully runs, and it may help the others, too: g++ -I$home/win7/include Polynomial.cpp -L/cygdrive/c/cygwin/home/Win7/libpaillier -l:libpaillier.a -L$home/win7/lib -lntl -lgmpxx -lgmp -lm – Adrian Jun 08 '15 at 16:15