On 04/02/2014 20:31, MPIR Team wrote:

> ---------- Forwarded message ----------
> From: *Terence Henriod* <thenr...@gmail.com <mailto:thenr...@gmail.com>>
> Date: 7 January 2014 01:14
> Subject: Having Difficulty Installing/Building MPIR
> To: thempirt...@gmail.com <mailto:thempirt...@gmail.com>
> 
> 
> Hello MPIR Team,
> 
> I'm not sure if you really do support using this e-mail address, but the
> Contact Us portion of your website led me to this address.
> 
> I am trying to build MPIR on my personal computer, mostly for
> recreational use (Project Euler  and the like).
> 
> I used Rick Reagan's instructions
> at 
> http://www.exploringbinary.com/how-to-install-and-run-gmp-on-windows-using-mpir/
>  since
> they seem to be referenced by many people across the web, but I'm not
> sure how applicable they are to my machine and setup.
> 
> I am using a Lenovo T530 machine with an Intel Core i5-3360M 2.80GHz
> processor. My OS is Windows 7 Home Premium 64-bit. I am using the Visual
> Studio Professional 64-bit programming environment. I am trying to
> install mpir-2.6.0, and I used vsyasm-1.2.0-win64 as the assembler.
> 
> I followed Rick's instructions for installing the C++ wrapper (mpirxx)
> in addition to the C part. I can have a project build when I #include
> <mpirxx.h>, but when I try to use the integer type, I get several linker
> errors that seem to indicate that there are several MPIR methods that
> the compiler is missing definitions for. To follow is the code and the
> error list.
> 
> I am hoping that I have just missed a file that needed to be included in
> the VS directories, and really hope that none of this is occurring
> because I tried to build things meant for VS2010 in VS2012. I have also
> become very sorry I am using Windows and not Linux ;) .
> 
> This is my first time trying to install an external library, so it is
> highly possible that I made some other mistakes somewhere.
> 
> Thank you for your time, I appreciate any help/pointers.
> 
> Sincerely, 
> Terence
> 
> The errors:
> 
> error LNK2001: unresolved external symbol __gmpz_set_si
> error LNK2001: unresolved external symbol __gmpz_clear
> error LNK2001: unresolved external symbol __gmpz_init_set_si
> error LNK2001: unresolved external symbol __gmpz_get_str                
>  mpirxx.lib(ompz.obj)
> error LNK2001: unresolved external symbol __gmp_asprintf_memory    
>  mpirxx.lib(osfuns.obj)
> error LNK2001: unresolved external symbol __gmp_asprintf_reps          
>  mpirxx.lib(osfuns.obj)
> error LNK2001: unresolved external symbol __gmp_asprintf_final          
>  mpirxx.lib(osdoprnti.obj)
> error LNK2001: unresolved external symbol __gmp_doprint_integer      
>  mpirxx.lib(osdoprnti.obj)
> error LNK2001: unresolved external symbol __gmp_allocate_func        
>  mpirxx.lib(osdoprnti.obj)
> error LNK2001: unresolved external symbol __gmp_free_func              
>  mpirxx.lib(osdoprnti.obj)
> 
> According to VS:
> The first 3 are related to project_euler_problem_16.o (my file).
> The rest are related to various mpirxx.lib files listed next to the errors.
> 
> The code:
> 
> // This is for an unfinished program to find the sum of the digits
> // of 2^1000
> #include <cassert>
> #include <cmath>
> #include <cstdio>
> #include <iostream>
> #include <iomanip>
> #include <fstream>
> #include <mpirxx.h>
> using namespace std;
> 
> int main(int argc, char** argv) {
>   // variables
>   unsigned int power = 1000;
>   unsigned int digit_sum = 0;
>   mpz_class large_number = 0;
>   char file_name [] = "project_euler_problem_16.txt";
>   ofstream fout;
>   FILE* file;
> 
>   // get the power of 2 to use
>   printf("The number whose digits to be summed is: 2^");
>   scanf("%u", &power);
> 
>   // compute the power
>   large_number =  4;     //pow(2, power);
> 
> cout << large_number << endl;
> 
>   // write it to the file
>   file = fopen(file_name, "w");
>   fprintf(file, "%lf", large_number);
>   fclose(file);
> 
>   // compute the sum of the digits
>   //digit_sum = sumDigits(file_name);
> 
>   // report the result to the user
>   printf("\nThe sum of %lf's \ndigits is: %u\n", large_number, digit_sum);
>   scanf("%s", file_name);
> 
>   // return 0 on successful completion
>   return 0;
> }

My apologies for this delay in answering your query but I have only just
became aware of it.  If it is still active, I am happy to see if I can
offer any advice on how to fix it.

I ran your program myself and it links fine so I think something is
missing from your Visual Studio configuration for the project.

Firstly are you sure that you are linking with the correct Mirosoft
libraries.  By default Visual C++ links to the DLL run-time libraries
but MPIR links to the static run-time libraries. This is set on the
C/C++|Code Generation|Runtime library item.

Secondly have you added links to both mpir.lib AND mpirxx.lib under the
Linker|Input|Additional Dependencies item?  From your error summary it
seems that either or both these libraries may be missing.

I can send you my Visual Studio build files for your project if you
can't get it to work.  I set up projects in parallel directories like this:

    mpir             - where mpir is placed
    mpir application - a project using mpir (i.e your application)

so you would have to use the same layout to use them.

Let me know if you still need help.

   best regards,

     Brian

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mpir-devel+unsubscr...@googlegroups.com.
To post to this group, send email to mpir-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/mpir-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to