title: Compiling error in Codeblocks undefined reference to `__gmpz_mul_ui'
body: <p>So I'm trying to compile this code here in Codeblocks :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;gmpxx.h&gt;
  
  using namespace std;
  
  void
  myfunction (mpz_t result, mpz_t param, unsigned long n)
  {
    unsigned long  i;
  
    mpz_mul_ui (result, param, n);
    for (i = 1; i &lt; n; i++)
      mpz_add_ui (result, result, i*7);
  }
  
  int
  main (void)
  {
    mpz_t  r, n;
    mpz_init (r);
    mpz_init_set_str (n, "123456", 0);
  
    myfunction (r, n, 20L);
    mpz_out_str (stdout, 10, r); printf ("\n");
  
    return 0;
  }
  </code></pre>
  
  <p>and i get this error when i go to compile</p>
  
  <pre><code>    -------------- Build: Debug in orcs (compiler: GNU GCC Compiler)---------------
  
  mingw32-g++.exe -L..\..\Lzip\gmp-6.1.0 -L..\..\Lzip\gmp-6.1.0 -o bin\Debug\orcs.exe obj\Debug\main.o   ..\..\Lzip\mybuilddir\.libs\libgmpxx.a
  obj\Debug\main.o: In function `Z10myfunctionP12__mpz_structS0_m':
  C:/Users/Joe.Joe/Documents/FMC/orcs/main.cpp:11: undefined reference to `__gmpz_mul_ui'
  C:/Users/Joe.Joe/Documents/FMC/orcs/main.cpp:13: undefined reference to `__gmpz_add_ui'
  obj\Debug\main.o: In function `main':
  C:/Users/Joe.Joe/Documents/FMC/orcs/main.cpp:20: undefined reference to `__gmpz_init'
  C:/Users/Joe.Joe/Documents/FMC/orcs/main.cpp:21: undefined reference to `__gmpz_init_set_str'
  C:/Users/Joe.Joe/Documents/FMC/orcs/main.cpp:24: undefined reference to `__gmpz_out_str'
  collect2.exe: error: ld returned 1 exit status
  Process terminated with status 1 (0 minute(s), 0 second(s))
  5 error(s), 0 warning(s) (0 minute(s), 0 second(s))
  </code></pre>
  
  <p>Now I have looked into the this problem on google, but those solutions i have found dont seem to be working.</p>
  
  <p>Right now under Project> Build Options > Search Directories > Linker , I have the location of gmp-6.1.0</p>
  
  <p>I have tried putting gmp In the Project > Build Options > Linker Settings > Other Linker Options , however this doesnt work and instead gives me this : </p>
  
  <pre><code>-------------- Build: Debug in orcs (compiler: GNU GCC Compiler)---------------
  
  mingw32-g++.exe -L..\..\Lzip\gmp-6.1.0 -L..\..\Lzip\gmp-6.1.0 -o bin\Debug\orcs.exe obj\Debug\main.o  gmp  ..\..\Lzip\mybuilddir\.libs\libgmpxx.a
  mingw32-g++.exe: error: gmp: No such file or directory
  Process terminated with status 1 (0 minute(s), 0 second(s))
  1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
  </code></pre>
  
  <p>I'm not exactly sure where the problem is, because I'm pretty sure everything was installed in the default place. Hopefully this is enough info to help me out :)</p>