title: Undefined reference to CryptoPP::AlignedAllocate(unsigned int)
body: <p>I am using crypto++ in c++ linux.
  Here is my simple code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string.h&gt;
  
  #include "crypto++/cryptlib.h"
  #include "crypto++/modes.h"
  #include "crypto++/filters.h"
  #include "crypto++/aes.h"
  #include "crypto++/osrng.h"
  #include "crypto++/strciphr.h"
  
  using namespace std;
  using namespace CryptoPP;
  
  ifstream::pos_type size;
  char * memblock;
  int length;
  char * _iv[AES::BLOCKSIZE];
  char * keys[AES::MAX_KEYLENGTH];
  
  
  void encriptCTR(byte * outbyte, const byte * inbyte, const byte * key, const byte * iv);
  
  void encriptCTR(byte * outbyte, const byte * inbyte, const byte * key, const byte * iv)
  {
      size_t inbyte_len = strlen((const char *)inbyte);
      CTR_Mode&lt;AES&gt;::Encryption ctr_encription(key, strlen((const char*)key), iv);
      ctr_encription.ProcessData(outbyte, inbyte, inbyte_len);
  }
  
  int main()
  {
      ifstream file;
      file.open("testaja", ios::binary);
      if (file.is_open())
      {
          file.seekg (0, ios::end);
          length = file.tellg();
          memblock = new char [length];
          file.seekg (0, ios::beg);
          file.read (memblock, length);
  
  
          if (!file)
          {
              int a;
              a = (int)file.gcount();
              file.clear();
          }
          else
          {
              file.close();
  
              for (int i = 0; i &lt; length; ++i)
              {
                  cout &lt;&lt; hex &lt;&lt; (int)memblock[i] &lt;&lt; " ";
              }
  
          }
      }
  }
  </code></pre>
  
  <p>When I run it , some error occured:</p>
  
  <pre><code> undefined reference to `CryptoPP::AlignedAllocate(unsigned int)'
   undefined reference to `CryptoPP::UnalignedAllocate(unsigned int)'
   undefined reference to `CryptoPP::AlignedDeallocate(unsigned int)'
   undefined reference to `CryptoPP::UnalignedDeallocate(unsigned int)'
  </code></pre>
  
  <p>Then, I used command</p>
  
  <pre><code>gcc -o test test.cpp -L/usr/lib/crypto++ -lcrypto++
  </code></pre>
  
  <p>but this error still there :</p>
  
  <pre><code>undefined reference to `CryptoPP::AlignedAllocate(unsigned int)'
  undefined reference to `CryptoPP::UnalignedAllocate(unsigned int)'
  undefined reference to `CryptoPP::AlignedDeallocate(unsigned int)'
  undefined reference to `CryptoPP::UnalignedDeallocate(unsigned int)'
  </code></pre>
  
  <p>How can I fix this error?
  Is there something wrong with my code?</p>
  
  <p>I am installing crypto++ using synaptic package manager for this package:</p>
  
  <pre><code>libcrypto++-utils
  libcrypto++8
  libcrypto++8-dbg
  libcrypto++-dev
  libcrypto++-doc
  </code></pre>
  
  <p>and libcrypto++.a and libcrypto++.so can be found in /usr/lib/</p>
  
  <p>Thanks in advance.</p>