I am working on porting a linux app that depends on OpenSSL to windows
and ran into the visual studio 2009 "c2226" unexpected type "LPCSTR".
The order of #includes that can generate this error is shown below.
Note that only ssl includes are used. Adding a #undef X509_NAME after
the rand include fixes the problem, BUT only if rand is included
before engine. I looked at both header files and noticed that rand
includes windows.h, which causes the problem. Also, engine.h includes
rand.h. Rand does not use the X509_NAME type within its header
definition, but engine does.
Long story short, I think rand.h should undefine X509_NAME immediately
after its include of windows.h....this seemed to fix my problems. The
other solution was to include rand, undefine the name, then include
engine.
I ran into a previous post on the net to use the NOCRYPT option which
forces visual studio to not include the windows crypto api's, which is
ultimately the culprit in redefining X509_NAME. This worked as well,
but I didn't feel it was the correct solution.
Chime in and let me know if I am off base here or if the rand.h header
fix is a valid one.
Code:
#include <openssl/ssl.h>
#include <openssl/rand.h>
// do the following if proposed fix to rand.h is not there
// this only works if engine.h follows rand.h, at least In
// my initial screwing around
// undef X509_NAME
#include <openssl/engine.h>
#incude <openssl/err.h>
#include <openssl/x503v3.h>
#include <openssl/fips.h>
Cheers,
--Domingo
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openss...@openssl.org
Automated List Manager majo...@openssl.org
--Domingo