title: Linking C files Error: linker command failed with exit code 1
body: <p>I have three files, rsa.c, prf.c, and rsa-test.c.</p>
  
  <p>I use <code>gcc -c rsa.c</code>, <code>gcc -c prf.c</code>, <code>gcc -c rsa-test.c</code> to get the .o files.</p>
  
  <p><strong>EDIT</strong>: I included rsa.c and prf.c in rsa-test.c.</p>
  
  <p>Then I compile the .o files using <code>gcc -o test rsa.o prf.o rsa-test.o</code>.</p>
  
  <p>I get the following error when I compile the. o files of three files.</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_EVP_sha512", referenced from:
        randBytes(unsigned char*, unsigned long) in prf.o
    "_HMAC", referenced from:
        randBytes(unsigned char*, unsigned long) in prf.o
    "_SHA512", referenced from:
        setSeed(unsigned char*, unsigned long) in prf.o
    "___gmpz_add_ui", referenced from:
        randBytes(unsigned char*, unsigned long) in prf.o
    "___gmpz_clear", referenced from:
        rsa_shredKey(_RSA_KEY*) in rsa.o
    "___gmpz_export", referenced from:
        zToFile(__sFILE*, __mpz_struct*) in rsa.o
    "___gmpz_import", referenced from:
        zFromFile(__sFILE*, __mpz_struct*) in rsa.o
    "___gmpz_init", referenced from:
        rsa_initKey(_RSA_KEY*) in rsa.o
        setSeed(unsigned char*, unsigned long) in prf.o
    "___gmpz_limbs_read", referenced from:
        randBytes(unsigned char*, unsigned long) in prf.o
    "___gmpz_limbs_write", referenced from:
        rsa_shredKey(_RSA_KEY*) in rsa.o
    "___gmpz_set_ui", referenced from:
        rsa_initKey(_RSA_KEY*) in rsa.o
        setSeed(unsigned char*, unsigned long) in prf.o
    "___gmpz_size", referenced from:
        zToFile(__sFILE*, __mpz_struct*) in rsa.o
        rsa_numBytesN(_RSA_KEY*) in rsa.o
        rsa_shredKey(_RSA_KEY*) in rsa.o
        randBytes(unsigned char*, unsigned long) in prf.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>I'm not sure what is causing this error. The linker seems like the problem, because I'm using functions from rsa.c and prf.c in rsa-test.c and that's what's causing this problem.</p>
  
  <p>Please let me know if you would like to test my files, I will post them up.</p>