Important: Please read the Qt Code of Conduct -

Link library MSVC

  • My project compiles with MinGW 5.3 and Qt 5.7.0. However, with MSVC 2015 32 bit I get unresolved external symbol for CryptAcquireContextW and RegCloseKey. I found that libraries needed are advapi32 and crypt32.

    I don't have to specify these libraries explicitly in *.pro file for MinGW but it seems MSVC needs it. How to modify *.pro file so it compiles for both MinGW and MSVC?

    I already tried to add LIBS += -ladvapi32 -lcrypt32 but that doesn't work for MSVC compilation - I still get unresolved external symbols.

  • @MartinD
    Add them as additional libraries to your project and try it.

    Check this , for adding additional libs in MSVC

  • I'm sorry, I should have mentioned that I use Qt Creator, not Visual Studio.

  • Moderators

    LIBS += -ladvapi32 -lcrypt32 is enough. Make sure you re-run qmake after you edited the .pro file (Build - > Run qmake).

  • Thank you. Re-run of qmake fixed it.

Log in to reply