compiling error when using cryptlib with wxwidgets

View: New views
5 Messages — Rating Filter:   Alert me  

compiling error when using cryptlib with wxwidgets

by Mathias Spoerr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I use cryptlib for a long time with MFC. Now I want to port my application to wxwidgets and get the following error when building the project:

"cryptlib.h and wincrypt.h can't both be used at the same time due to conflicting type names"

I found the following thread on this list which describes the same problem:

http://search.gmane.org/search.php?group=gmane.comp.encryption.cryptlib&query=wxwidgets

 

Is there any known solution for this issue?

 

Thanks,

Mathias




_______________________________________________
Cryptlib mailing list
Cryptlib@... via Mail: cryptlib-request@...
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.

Re: compiling error when using cryptlib with wxwidgets

by Peter Gutmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Spoerr Mathias <mathias@...> writes:

>I use cryptlib for a long time with MFC. Now I want to port my application to
>wxwidgets and get the following error when building the project:
>
>"cryptlib.h and wincrypt.h can't both be used at the same time due to
>conflicting type names"
>
>I found the following thread on this list which describes the same problem:
>
>http://search.gmane.org/search.php?group=gmane.comp.encryption.cryptlib&query=wxwidgets
>
>Is there any known solution for this issue?

The resolution's still the same as last time:

  My guess is that wxWidgets 2.6.3 pulls in wincrypt.h in some way, this can't
  be used at the same time as cryptlib because wincrypt.h uses proprocessor
  defines with the same name as cryptlib ones (although cryptlib used them
  first :-).  You'd have to find out where/how wincrypt.h is being pulled in
  and then see how to exclude it, without access to the wxWidgets tools it's
  hard for me to tell what the fix is.

The way to do this is to remove the #error directive from cryptlib.h (line 44)
and see which defines conflict, then #undef them after the include of
<windows.h> (line 40), if you can make the changes in the form:

#ifdef __WXWINDOWS__
  #undef <whatever>
#endif /* __WXWINDOWS__ */

then I'll roll them into future versions of cryptlib.  My guess is that:

#undef CRYPT_MODE_ECB
#undef CRYPT_MODE_CBC
#undef CRYPT_MODE_CFB
#undef CRYPT_MODE_OFB

may be enough, but I don't use wxWidgets so I don't know what CryptoAPI
capabilities it enables.

Peter.

_______________________________________________
Cryptlib mailing list
Cryptlib@... via Mail: cryptlib-request@...
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.

Re: compiling error when using cryptlib with wxwidgets

by marek_silewicz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can also define NOCRYPT option in order to disable include of
wincrypt.h
Define this _before_ include of wx stuff. For example (standard include
mechanism)

#define NOCRYPT /* Disable include of wincrypt.h */

#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

..

pgut001@... (Peter Gutmann) napisał(a):

> Spoerr Mathias <mathias@...> writes:
>
>> I use cryptlib for a long time with MFC. Now I want to port my
>> application to
>> wxwidgets and get the following error when building the project:
>>
>> "cryptlib.h and wincrypt.h can't both be used at the same time due to
>> conflicting type names"
>>
>> I found the following thread on this list which describes the same
>> problem:
>>
>> http://search.gmane.org/search.php?group=gmane.comp.encryption.cryptlib
>> &query=wxwidgets
>>
>> Is there any known solution for this issue?
>
> The resolution's still the same as last time:
>
>   My guess is that wxWidgets 2.6.3 pulls in wincrypt.h in some way, this
> can't
>   be used at the same time as cryptlib because wincrypt.h uses
> proprocessor
>   defines with the same name as cryptlib ones (although cryptlib used
> them
>   first :-).  You'd have to find out where/how wincrypt.h is being pulled

> in
>   and then see how to exclude it, without access to the wxWidgets tools
> it's
>   hard for me to tell what the fix is.
>
> The way to do this is to remove the #error directive from cryptlib.h
> (line 44)
> and see which defines conflict, then #undef them after the include of
> <windows.h> (line 40), if you can make the changes in the form:
>
> #ifdef __WXWINDOWS__
>   #undef <whatever>
> #endif /* __WXWINDOWS__ */
>
> then I'll roll them into future versions of cryptlib.  My guess is that:
>
> #undef CRYPT_MODE_ECB
> #undef CRYPT_MODE_CBC
> #undef CRYPT_MODE_CFB
> #undef CRYPT_MODE_OFB
>
> may be enough, but I don't use wxWidgets so I don't know what CryptoAPI
> capabilities it enables.
>
> Peter.
>
> _______________________________________________
> Cryptlib mailing list
> Cryptlib@... via Mail:
> cryptlib-request@...
> Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
> http://news.gmane.org/gmane.comp.encryption.cryptlib
> Posts from non-subscribed addresses are blocked to prevent spam, please
> subscribe in order to post messages.




_______________________________________________
Cryptlib mailing list
Cryptlib@... via Mail: cryptlib-request@...
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.

Re: compiling error when using cryptlib with wxwidgets

by Mathias Spoerr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Peter,
thank you very much for the suggested way to find the problem. I am only
a hobby developer and a bit confused of the solution you gave last time.
The new explanation I understand (I hope ;)) and I will come back how it
works.

Thank you again,
Mathias

Peter Gutmann schrieb:

> Spoerr Mathias <mathias@...> writes:
>
>  
>> I use cryptlib for a long time with MFC. Now I want to port my application to
>> wxwidgets and get the following error when building the project:
>>
>> "cryptlib.h and wincrypt.h can't both be used at the same time due to
>> conflicting type names"
>>
>> I found the following thread on this list which describes the same problem:
>>
>> http://search.gmane.org/search.php?group=gmane.comp.encryption.cryptlib&query=wxwidgets
>>
>> Is there any known solution for this issue?
>>    
>
> The resolution's still the same as last time:
>
>   My guess is that wxWidgets 2.6.3 pulls in wincrypt.h in some way, this can't
>   be used at the same time as cryptlib because wincrypt.h uses proprocessor
>   defines with the same name as cryptlib ones (although cryptlib used them
>   first :-).  You'd have to find out where/how wincrypt.h is being pulled in
>   and then see how to exclude it, without access to the wxWidgets tools it's
>   hard for me to tell what the fix is.
>
> The way to do this is to remove the #error directive from cryptlib.h (line 44)
> and see which defines conflict, then #undef them after the include of
> <windows.h> (line 40), if you can make the changes in the form:
>
> #ifdef __WXWINDOWS__
>   #undef <whatever>
> #endif /* __WXWINDOWS__ */
>
> then I'll roll them into future versions of cryptlib.  My guess is that:
>
> #undef CRYPT_MODE_ECB
> #undef CRYPT_MODE_CBC
> #undef CRYPT_MODE_CFB
> #undef CRYPT_MODE_OFB
>
> may be enough, but I don't use wxWidgets so I don't know what CryptoAPI
> capabilities it enables.
>
> Peter.
>
> _______________________________________________
> Cryptlib mailing list
> Cryptlib@... via Mail: cryptlib-request@...
> Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
> http://news.gmane.org/gmane.comp.encryption.cryptlib
> Posts from non-subscribed addresses are blocked to prevent spam, please
> subscribe in order to post messages.
>
>  


_______________________________________________
Cryptlib mailing list
Cryptlib@... via Mail: cryptlib-request@...
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.

Parent Message unknown Re: compiling error when using cryptlib with wxwidgets

by Mathias Spoerr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.


pgut001@... (Peter Gutmann) napisał(a):

> then I'll roll them into future versions of cryptlib. My guess is that:
>
> #undef CRYPT_MODE_ECB
> #undef CRYPT_MODE_CBC
> #undef CRYPT_MODE_CFB
> #undef CRYPT_MODE_OFB
>
> may be enough, but I don't use wxWidgets so I don't know what CryptoAPI
> capabilities it enables.
>


Hi Peter,

thank you for your tip - it works now with your changes.

Mathias



_______________________________________________
Cryptlib mailing list
Cryptlib@... via Mail: cryptlib-request@...
Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/
http://news.gmane.org/gmane.comp.encryption.cryptlib
Posts from non-subscribed addresses are blocked to prevent spam, please
subscribe in order to post messages.