title: Assigning complex values in gsl
body: <p>I am trying to use GSL for <code>complex numbers</code>, <code>complex vectors</code> and <code>complex matrices</code> in my project. I am using VS2010 and I added the address of library in <strong>Configuration Properties&gt;C/C++&gt;General&gt;Additional Include Directories</strong>.  But I have a stupid problem. As far as I understood, I can not use <code>=</code> to assign two <code>gsl_complex</code>, <code>gsl_vector_complex</code> or <code>gsl_matrix_complex</code> to each other.</p>
  <p>For vectors I have to use <code>gsl_vector_complex_set</code> and for matrices <code>gsl_matrix_complex_set</code>. But for gsl_complex, I only found  <strong>GSL_SET_COMPLEX</strong> in which I should give the real and imaginary parts seperatly as 2 arguments:</p>
  <pre><code>GSL_SET_COMPLEX (zp, real, imaginary)
  </code></pre>
  <p>In my code I have such function:</p>
  <pre><code>gsl_complex cmx, cmx2;
  void vector_complex_exp(gsl_vector_complex *v)
  {
      for (i = 0; i &lt; v-&gt;size; i++)
      {
          gsl_vector_complex_set(v, i, gsl_complex_exp(gsl_vector_complex_get(v, i)));
      }
  }
  </code></pre>
  <p>Using this, I get following errors:</p>
  <blockquote>
  <p>error LNK1120: 2 Unresolved external references.</p>
  <p>error LNK2001: Unresolved external symbol &quot;_hypot&quot;.</p>
  <p>error LNK2001: Unresolved external symbol &quot;_log1p&quot;.</p>
  <p>error LNK2001: Unresolved external symbol &quot;_log1p&quot;.</p>
  </blockquote>
  <p>I didn't understand the reason behind these errors. But I rewrite my code like this:</p>
  <pre><code>void vector_complex_exp(gsl_vector_complex *v)
  {
      for (i = 0; i &lt; v-&gt;size; i++)
      {
          cmx = gsl_vector_complex_get(v, i);
          //cmx2 = gsl_complex_exp(cmx);
          gsl_vector_complex_set(v, i, cmx2);
      }
  }
  </code></pre>
  <p>Here when the second line in for is commented, there's no error. But when I uncomment it I get the following:</p>
  <blockquote>
  <p>error LNK1120: 2 non-resolved external references.</p>
  <p>error LNK2001: Unresolved external symbol &quot;_log1p&quot;.</p>
  <p>error LNK2019: Reference to non-resolved external symbol &quot;_hypot&quot; in function &quot;_gsl_complex_div&quot;.</p>
  <p>error LNK2019: Reference to non-resolved external symbol &quot;_log1p&quot; in function &quot;_gsl_complex_logabs&quot;.</p>
  </blockquote>
  <p>I don't have any <code>_gsl_complex_div</code> or <code>_gsl_complex_logabs</code> function in my code. So I am pretty sure that the problem is with assignment here. But I can not use GSL_SET_COMPLEX here too.</p>
  <p>Can someone help me with this? Is there really no way to assign a value to gsl_complex directly?</p>