John Gowers
John Gowers

Reputation: 2736

How to create a makefile to use the mpir and mpfr libraries

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:

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:

Here is what I can't do:

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!

Upvotes: 1

Views: 399

Answers (1)

Praetorian
Praetorian

Reputation: 109089

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.

Upvotes: 1

Related Questions