As I understand, I should first install GMP. The only tutorial I found for this purpose is http://cs.nyu.edu/exact/core/gmp/ and when I reach step 3: "Open gmp.dsw (gmp.vcproj for VC++.Net) to build GMP" I get many building errors. You can download it here: http://www.f2h.co.il/msbz68nzzip. There are many errors like "fatal error C1083: Cannot open include file: 'fib_table.h': No such file or directory".
Is there an other tutorial? What should I do?
I'm using Visual Studio 2010 on Windows 7.
This guide will help you get up and running with a VS project using MPFR and MPIR (a Windows port of GMP) using some prebuilt binaries. (Here is a link to a VS project and the downloaded binaries I mention: https://www.dropbox.com/s/p08cw59bic4f02v/MPFR-VSProj.zip?dl=1)
Get the pre-compiled files from: http://www.holoborodko.com/pavel/mpfr/#projects
mpfr_mpir_x86_x64_msvc2010 (precompiled mpfr mpir with MSVC 2010
Since it was compiled with MSVC 2010, it needs Microsoft Visual C++ 2010 * Redistributable. If we try to run the program in Debug mode, we won't be able to. we'll get this error: "The program cant't start becaue MSVCP100.dll is missin from your computer". Essentially, MSVCP100.dll is part of the Visual Studio 2010 install but not in the Redistributable, which only contains the dlls needed for release versions of builds
- NOTE: visual studio still allows one to debug in the Release configuration so debugging isn't a big issue at this stage when you are just trying to get up and running
mpfrc++-3.6.2 (c++ wrapper by Holoborodko)
NOTE: these binaries are a few years old but they are tested and "relatively bug-free"
This is necessary to get going for now since we are missing the debug dlls in the 2010 Redistributable (should have been installed as part of VS install)
Configuration Properties > VC++ Directories
- Include Directories: add path to your include directory
- Library Directories: add path to your lib directory
Configuration Properties > Linker > Input > Additional Dependencies
- Add the following to this list: mpfr.lib; mpir.lib;
Configuration Properties > C/C++ > Code Generation > Runtime Library
- select "Multi Threaded DLL (/MD)"
Configuration Properties > Debugging > Command Arguments
- append: "-lmpfr -lgmp"
Configuration Properties > Build Events > Post-Build Event
- Command Line: 'XCOPY "$(SolutionDir)lib*.dll" "$(TargetDir)" /D /K /Y'
- Description: 'Copy DLLs to Target Directory'
- Use in Build: YES
Tell VS to clean up the DLLs when it cleans up an output folder:
Configuration Properties -> General -> Extensions to Delete on Clean
- add: '*.dll'
To Test your project, copy over the main() from "example/example.cpp" from the mpfrc++-3.6.2 folder
Helpful SO Articles: