I think that fix is fine for the x509.h include chain, but the problem
also exists for the rand.h include chain depending on include order.

--Domingo

On 10/18/09, sandeep kiran p <sandeepkir...@gmail.com> wrote:
> Same here. I too faced the same issue when I was trying to build the 'req'
> utility using Visual Studio. A short list of errors is as below
> d:\ssl\openssl-0.9.8k\include\openssl\store.h(390) : error C2059: syntax
> error : 'type'
> d:\ssl\openssl-0.9.8k\include\openssl\store.h(397) : error C2059: syntax
> error : ','
> d:\ssl\openssl-0.9.8k\include\openssl\store.h(397) : error C2143: syntax
> error : missing ')' before '('
> d:\ssl\openssl-0.9.8k\include\openssl\store.h(397) : error C2143: syntax
> error : missing ')' before '('
> d:\ssl\openssl-0.9.8k\include\openssl\store.h(397) : error C2091: function
> returns function
> d:\ssl\openssl-0.9.8k\include\openssl\store.h(397) : error C2091: function
> returns function
> <SNIP>
>
> All these errors seem to crop up because X509_NAME and X509_EXTENSIONS were
> defined in wincrypt.h. Though we seem to #undef them in x509.h
> for OPENSSL_SYS_WIN32. Is there any way out?
>
> Thanks,
> Sandeep
>
> On Fri, Oct 16, 2009 at 6:11 PM, Domingo Kiser
> <domingo.ki...@gmail.com>wrote:
>
>> Hello all,
>>
>> 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                    openssl-users@openssl.org
>> Automated List Manager                           majord...@openssl.org
>>
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to