c++ - 未找到 NTL 头文件

标签 c++ ubuntu ntl

我已经在我的 Ubuntu 上下载并安装了 NTL 库。我目前正在使用 gedit 编写我的程序,并在我的程序中包含此 ZZ.h header 。这就是我在终端中编译程序的方式: - g++ keygen.cpp -o keygen -I ../include -L ../lib -lntl -lm.

我很确定这条线是正确的,但由于某种未知的原因,我收到以下错误:

KeyGen.cpp:9:20: error: NTL/ZZ.h: No such file or directory
KeyGen.cpp:15: error: expected constructor, destructor, or type conversion before ‘int’

解决方案对我来说似乎非常简单:即将 NTL 库直接添加到我的程序文件夹中。我就是这样做的,但仍然遇到同样的错误。

最佳答案

如果您不需要最新(6.0.0)版本的 NTL,您可以在 Ubuntu 中执行以下操作:

user@host:~$ sudo apt-get install libntl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libntl-5.4.2
The following NEW packages will be installed:
  libntl-5.4.2 libntl-dev
0 upgraded, 2 newly installed, 0 to remove and 112 not upgraded.
Need to get 2,035 kB of archives.
After this operation, 7,016 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.de.debian.org/debian/ squeeze/main libntl-5.4.2 amd64 5.4.2-4 [767 kB]
Get:2 http://ftp.de.debian.org/debian/ squeeze/main libntl-dev amd64 5.4.2-4 [1,268 kB]
Fetched 2,035 kB in 2s (1,017 kB/s)   
Selecting previously deselected package libntl-5.4.2.
(Reading database ... 59184 files and directories currently installed.)
Unpacking libntl-5.4.2 (from .../libntl-5.4.2_5.4.2-4_amd64.deb) ...
Selecting previously deselected package libntl-dev.
Unpacking libntl-dev (from .../libntl-dev_5.4.2-4_amd64.deb) ...
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up libntl-5.4.2 (5.4.2-4) ...
Setting up libntl-dev (5.4.2-4) ..
user@host:~$ 

之后,包含所有开发头文件的完整编译 NTL 库将安装在您的系统中,您可以使用它编译您的程序,而无需任何额外的 -I

如果您需要发行版具有的更新版本(检查 http://packages.ubuntu.com/en/source/trusty/ntl ),您可以尝试自己构建库包。

关于c++ - 未找到 NTL 头文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21457079/

相关文章:

c++ - 错误: no matching function for call to 'function namel'

c++ - NTL 字符串到 ZZ 转换以及 ZZ 到字符串

c++ - OpenCV,DFT 函数不要在带有 IMREAD_COLOR 的图像中使用

c++ - 为什么链接了很多目标文件而不是一个大目标文件?

ubuntu - ssh/shh-copy-id 适用于 root 但不适用于其他用户

apache - Sqoop:找不到命令

c++在转换中为多数组错误添加值(value)

c++ - 窗体上对象的迭代

ubuntu - 没有为 nginx pagespeed 模块制作目标模块的规则

c++ - 如何使用 NTL 库 (C++) 对数字进行下限