Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL

NTL 介绍

NTL is a high-performance, portable C++ library providing data structures and algorithms for manipulating signed, arbitrary length integers, and for vectors, matrices, and polynomials over the integers and over finite fields.

步骤

1.在 https://www.shoup.net/ntl/ 下载 WinNTL-11_4_3.zip , 并解压到 任意目录 (目录不要有中文和空格,以下也是)

2.将WinNTL-11_4_3中include文件夹下的文件复制到codeblocks安装目录/MinGw/include

3.打开codeblocks 新建一个 static library 项目 项目名字lib(名字随意)
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL右键lib项目,Add files(添加文件),添加 WinNTL-11_4_3解压目录/src 文件夹下所有文件
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL点击打开,成功后如图所示
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL点击 Settings/Compiler/Search directories

添加 WinNTL-11_4_3解压目录\include 目录
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL编译项目
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL等待编译完成后, Settings/Compiler/Linker settings ,点击Add , 从 项目路径\lib\bin\Debug 中添加 lib.a 文件

Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL至此NTL已经配置好了!

测试

新建项目 选择控制台应用程序
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTLA Tour of NTL: Examples 中, 有很多NTL的样例

比如我们选择Big Integers 来测试下
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL复制代码到codeblocks中, 编译运行,随便敲两个大数,看到程序很快就给出了结果
Windows 10/8/7 - CodeBlocks 安装 和 编译 NTL

首发于

Laphel
https://blog.laphel.com/