title: GMP Library, compile error in C++, MinGW, Code::Blocks
body: <p>I have built GMP for MinGW. The IDE I'm using is Code::Blocks. I don't have any problems with C functions of GMP. But I'm having problem with C++. The program I tried to run is as simple as this,</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;gmpxx.h&gt;
  using namespace std;
  
  main()
  {
      mpz_class a;
      a=12345;
      cout&lt;&lt;"value"&lt;&lt;a&lt;&lt;"\n";
      return 0;
  }
  </code></pre>
  
  <p>And the Errors I get are </p>
  
  <pre><code>F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osmpz.o):osmpz.cc|| undefined reference to `__gmpz_get_str'|
  F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x1c)||undefined reference to `__gmp_asprintf_memory'|
  F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x20)||undefined reference to `__gmp_asprintf_reps'|
  F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osdoprnti.o):osdoprnti.cc|| undefined reference to `__gmp_doprnt_integer'|
  F:\Compilers\C_Libraries\GMP\lib\libgmpxx.a(osdoprnti.o):osdoprnti.cc|| undefined reference to `__gmp_asprintf_final'|
  ||=== Build finished: 5 errors, 0 warnings ===|
  </code></pre>
  
  <p>Now, some additional data:</p>
  
  <ol>
  <li>I don't have any problem with C functions. And also, if I remove cout&lt;&lt; statement the file compiles and runs fine. The problem is probably with overloaded operators.</li>
  <li>libgmpxx.a and libgmp.a are linked with compiler. It can be seen in the error messages too...</li>
  <li>The problem is probably with the libgmpxx.a alone. So, I built the Library again, but the files are same.</li>
  <li>I used this tutorial build GMP with MSYS for MinGW. <a href="http://www.cs.nyu.edu/exact/core/gmp/" rel="nofollow">http://www.cs.nyu.edu/exact/core/gmp/</a> and <a href="http://suchideas.com/journal/2007/07/installing-gmp-on-windows/" rel="nofollow">http://suchideas.com/journal/2007/07/installing-gmp-on-windows/</a></li>
  <li>The version of GMP I'm using is 5.0.4.</li>
  </ol>
  
  <p>So, what I want to know is, what could be the problem? And how could it be solved?
  And, if unsolvable and if you have the working files for 5.0.4 version, please share it. :(</p>