title: Building Crypto++ 5.6.2 with Cygwin x86_64
body: <p>I am attempting to build CryptoPP with Cygwin x86_64, but I'm having some trouble with <code>osrng.cpp</code>.</p>
  
  <p>I'm using gcc's C++ compiler, and I'm getting the following error at <a href="http://sourceforge.net/p/cryptopp/code/328/tree/trunk/c5/osrng.cpp#l50" rel="nofollow noreferrer">line 50 of <code>osrng.cpp</code></a></p>
  
  <pre><code>$ make
  g++ -DNDEBUG -g -O2 -march=native -pipe -c osrng.cpp
  osrng.cpp: In constructor ‘CryptoPP::MicrosoftCryptoProvider::MicrosoftCryptoProvider()’:
  osrng.cpp:50:80: error: invalid conversion from ‘CryptoPP::MicrosoftCryptoProvider::ProviderHandle* {aka long unsigned int*}’ to ‘HCRYPTPROV* {aka long long unsigned int*}’ [-fpermissive]
    if(!CryptAcquireContext(&amp;m_hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
                                                                                  ^
  In file included from /usr/include/w32api/windows.h:95:0,
                   from osrng.cpp:19:
  /usr/include/w32api/wincrypt.h:646:26: error:   initializing argument 1 of ‘WINBOOL CryptAcquireContextA(HCRYPTPROV*, LPCSTR, LPCSTR, DWORD, DWORD)’ [-fpermissive]
     WINIMPM WINBOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv,LPCSTR szContainer,LPCSTR szProvider,DWORD dwProvType,DWORD dwFlags);
                            ^
  GNUmakefile:208: recipe for target 'osrng.o' failed
  make: *** [osrng.o] Error 1
  </code></pre>
  
  <p>I have successfully compiled the whole thing under the 32bit version of Cygwin before.</p>
  
  <p>How can I fix this for the 64bit edition?</p>
  
  <p><strong>EDIT</strong> As suggested by <a href="https://stackoverflow.com/users/580360/yaakov">@Yakov</a>'s <a href="https://stackoverflow.com/a/21506951/1296709">answer</a>, I replaced <code>if defined(_WIN64)if defined(__x86_64__)</code> by <code>if</code> in <a href="http://sourceforge.net/p/cryptopp/code/328/tree/trunk/c5/osrng.h#l30" rel="nofollow noreferrer">line 30 of <code>osrng.h</code></a>.
  Sadly though, I immediately run into the next problem, indicated by the following error:</p>
  
  <pre><code>$ make
  g++ -DNDEBUG -g -O2 -march=native -pipe -c fipstest.cpp
  In file included from dll.h:30:0,
                   from fipstest.cpp:8:
  osrng.h:34:19: error: expected ‘;’ at end of member declaration
    typedef unsigned __int64 ProviderHandle; // type HCRYPTPROV, avoid #include &lt;windows.h&gt;
                     ^
  osrng.h:34:27: error: ‘ProviderHandle’ does not name a type
    typedef unsigned __int64 ProviderHandle; // type HCRYPTPROV, avoid #include &lt;windows.h&gt;
                             ^
  osrng.h:38:2: error: ‘ProviderHandle’ does not name a type
    ProviderHandle GetProviderHandle() const {return m_hProvider;}
    ^
  osrng.h:40:2: error: ‘ProviderHandle’ does not name a type
    ProviderHandle m_hProvider;
    ^
  GNUmakefile:208: recipe for target 'fipstest.o' failed
  make: *** [fipstest.o] Error 1
  </code></pre>