Syntax errors in crypto.h

Don Payette payettedon at
Tue Aug 15 14:01:15 UTC 2023

I'm converting an existing Winsock app to have encryption by using OpenSSL.
I'm getting syntax errors attempting to compile my app. My environment is
Microsoft Visual C++.
I downloaded and installed the OpenSSL pre-compiled binaries and added the
following to the Include Directories.

   C:\Program Files\OpenSSL-Win64\includes

In my existing Socket.cpp file I added OpenSSL includes:

#include <stdio.h>
#include <string.h>
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <signal.h>

Severity Code                Description
                                               Project File


Error (active) E0077 this declaration has no storage class or type
specifier DFDS C:\Program Files\OpenSSL-Win64\include\openssl\crypto.h 344
Error (active) E0065 expected a ';'
  DFDS C:\Program Files\OpenSSL-Win64\include\openssl\crypto.h 344
OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int

The definition of OSSL_CRYPTO_ALLOC is in macros.h:

#  if defined(__GNUC__)
#   define OSSL_CRYPTO_ALLOC __attribute__((malloc))
#  elif defined(_MSC_VER)
#   define OSSL_CRYPTO_ALLOC __declspec(restrict)
#  else
#  endif
# endif

I figure it is using the _MSC_VER define, which is the __declspec one.

Any ideas what it is complaining about?

Don Payette
(cell) 479-216-6320 <(479)%20216-6320>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the openssl-users mailing list