VS2010中MIRACL lib 的生成

本文详细介绍了如何使用Visual C++ V8.0构建MIRACL数学库,并提供了创建项目、添加源文件和链接库的步骤。同时,展示了如何将库应用到一个简单的C++程序中,通过源代码文件进行测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

To build the MIRACL library with Visual C++ V8.0


Select New Project, Console Application


Name: miracl
Location: d:\myprojects (for example)
Solution name: miracl


Click OK


Click Application settings
Click on Static library.
Disable precompiled headers
Click on Finish


Click on Header Files in the left hand pane
Click on Project, and Add Existing Item
Add miracl.h and mirdef.h from wherever you have unzipped the miracl 
distribution


Click on Source Files in the left hand pane
Click on Project, and Add Existing Item
Add the following MIRACL source files from the miracl distribution 
to the project


mraes.c
mralloc.c
mrarth0.c
mrarth1.c
mrarth2.c
mrarth3.c
mrbits.c
mrbrick.c
mrbuild.c
mrcore.c
mrcrt.c
mrcurve.c
mrdouble.c
mrebrick.c
mrec2m.c
mrgf2m.c
mrfast.c
mrflash.c
mrflsh1.c
mrflsh2.c
mrflsh3.c
mrflsh4.c
mrfrnd.c
mrgcd.c
mrgcm.c
mrio1.c
mrio2.c
mrjack.c
mrlucas.c
mrmonty.c
mrmuldv.c
mrpi.c
mrpower.c
mrprime.c
mrrand.c
mrround.c
mrscrt.c
mrshs.c
mrshs256.c
mrshs512.c
mrsmall.c
mrsroot.c
mrstrong.c
mrxgcd.c
mrzzn2.c
mrzzn2b.c
mrzzn3.c
mrecn2.c


Then Click on Build miracl. The library is created in directory 
d:\myprojects\miracl\debug\miracl.lib


Alternatively create a release version in the obvious way (if desired).
Close this project


Again Select New Project, Win32 Console Application


Name: brent
Location: d:\myprojects
Solution name: brent


Click on OK, click on Application Settings, leave it as Console Application, 
and again disable precompiled headers.
Click on Finish.




Click on Header Files in the left hand pane
Click on Project, and Add Existing Item
Add miracl.h and mirdef.h from wherever you have unzipped the miracl 
distribution
Also add zzn.h and big.h (the files required here are indicated in the 
comment /* Requires: big.cpp zzn.cpp */ at the start of brent.cpp)


Click on Source Files in the left hand pane
Right click on the automatically generated file brent.cpp, and exclude it 
from the project.
Click on Project, and Add Existing Item
Add the file brent.cpp from the miracl distribution
Add the files zzn.cpp and big.cpp from the miracl distribution


Click on Project, and Add Existing Item. Navigate to where-ever the miracl 
library has been created (d:\myprojects\miracl\debug\) and add miracl.lib 
to the project. Answer No to the dialog that appears.


Click on Build brent


The source files are compiled and linked to the miracl library. To run the 

program Click on Debug, and then on Start without Debugging.


新建一个项目,直接把lib copy到项目,然后用source文件夹下的brent.c文件进行测试(如编译失败,请添加miracl的include目录):


如果需要编译成64位的库,则需要使用ms64doit.bat先生成可用的mirdef.h文件,然后用这个文件,在VS下选择X64编译器进行编译(注意添加mex.h)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值