Question

I've recently written a C program which uses the public-domain mpir and mpfr libraries. I've been compiling it on Windows, using the Microsoft Visual C++ 10.0 compiler. To get that to work, I had to do the following:

  • Download / build the mpir and mpfr libraries from http://gladman.plushost.co.uk/oldsite/computing/gmp4win.php
  • Move the files mpir.h and mpfr.h into the Include directory for the Microsoft compiler
  • Move the files mpir.lib, mpir.pdb, mpfr.lib and mpfr.pdb into the lib directory for the Microsoft compiler
  • #include mpir.h and mpfr.h in the program
  • Compile using cl <..module names..> /link mpir.lib mpfr.lib

I now want to send the source / header files I've written to someone else, along with a makefile that they can use to compile the code and check that it works. Since that person won't have the mpir / mpfr libraries installed, and might not be using the same compiler, I'm not quite sure how to do this.

Here is what I can do:

  • Send them the binaries mpir.lib, mpir.pdb, mpfr.lib and mpfr.pdb as well as the source / header files.

Here is what I can't do:

  • Send them my entire Microsoft Visual C++ 10.0 setup
  • Ask them to stick files in their Include and lib directories (unless there's no other way)

Ideally, I should be able to send them the source/header files, together with the pertinent mpir/mpfr binaries, and a makefile which they can then run to build the program.

Thanks in advance for your help!

Was it helpful?

Solution

Why on earth are you adding those files to your compiler installation path?? The compiler has command line options for specifying search paths.

For instance,

cl /I"path/to/mpfr/header" <...filenames...> /link /LIBPATH:"path/to/mpfr/lib" mpir.lib mpfr.lib

You should only have to send your source code, mpir.h, mpir.lib, mpfr.h and mpfr.lib. The PDB files contain debugging information, and are not necessary for compilation.

Also, I don't know how to create a makefile, but a simple batch file with the command above should suffice for something so simple.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top