Cannot find how to link to crypt32.dll

  • Hello there Qt folks!

    I am trying to use the function CryptProtectData defined and wincrypt.h (see and I need to link against crypt32.dll. And... I don't know how to do it.

    I've found crypt32.dll at C:\Windows\System32\ but that doesn't really help me solve the problem.

    Initially, I asked a question @stackoverflow ( about the error and was told to link against crypt32.dll

    I've programmed quite a bit at Linux where the things (seemed to be, at least) quite simpler, using the PKG_CONFIG and let it find the libraries.

    Any tips on how to link against crypt32 would be grateful :)

  • Hi,

    in your .pro file you can add this
    @win32:LIBS += -LC:/Windows/System32 -lcrypt32@

  • Thanks for your answer mcosta, yes, this fixed the problem, but now I am getting more linking problems, like:
    @error: undefined reference to _imp__SetUnhandledExceptionFilter@4' error: undefined reference to_imp__GetProcAddress@8'@

    I do not directly use these functions so I guess it has to do with chain dependency issues. Anyway, I searched for the functions GetProcAddress() and SetUnhandledExceptionFilter() and they seem to be at kernel32.dll, which is located at C:\Windows\System32 as well.

    Unfortunately, adding
    @win32:LIBS += -LC:/Windows/System32 -lkernel32 -lcrypt32@
    to the .pro file does not seem to solve the problem.

    Any suggestions?

  • Hi,

    what compiler are you using? What O.S. WindowsX ?
    I think this is a problem related to crypt32 dependencies.

    I don't know this library but, probably, you must include other DLL's

  • I am using MinGW under Windows 7.

    This is the first time I attempt programming in Windows and that's why I am quite unaware of how you have to link those dlls :/

  • Hi! I think you already know what i'm saying now, however.
    There are 2 ways for linking dlls to app:

    1. Link with *.h, *.lib. in building step you say compiler where is the lib and how to bind it. And get access to library's functions by *.h file.
    2. Load dll directly with "QLibrary":

  • qxoz thanks for the suggestion but I find the complexity of the problem to be more than it should. I am trying to use one of the standard (I mean ... it's there) dlls (the wincrypt.h one) along with windows.h.

    This is standard stuff, a simple linking rule should clear things out. How did the ones programming in windows used these libraries before?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.