Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Qt and Crypto++ on windows
QtWS25 Last Chance

Qt and Crypto++ on windows

Scheduled Pinned Locked Moved 3rd Party Software
5 Posts 5 Posters 14.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rafaelhamdan
    wrote on last edited by
    #1

    Hello, guys!

    As the title says, I'm kinda having trouble using Crypto++ and Qt on windows. I've used them on my project, but always on unix platforms. Yesterday, I had to compile it under windows though. The problem is that I need to use sha512 hash, and Qt hashing class does not give support for it (it supports only md4, md5 and sha1, as you guys probably already know). So, I had to find an alternative, and, of course, it was Crypto++.

    I downloaded the library on http://www.cryptopp.com/ and compiled it using the project it already comes with (it's a Visual Studio 2006 project, I opened it with Visual Studio 2008 and the program itself handled the conversion between 2006~2008). When it finished compiling it generated static and dynamic outputs (the first one contained only a .lib file, as usual, and the second one a .lib file - that should contain the references - and a .dll file). So, I opened my .pro file (which is built with Qt Creator) and added the line:

    LIBS += -LC:/Qt/libs/others/ -lcryptopp

    Both files (cryptopp.lib and cryptopp.dll) are inside the folder (C:/Qt/libs/others/). The thing is that when the project is finishing to compile and is linking against the libraries it generated a bunch of compiling errors, ALL of them about references (undefined reference to vtable CryptoPP::hash...), like if the .lib file was not being linked at all (but it IS).

    What do you guys think it could be? I tested both static and dynamic and both resulted on the same compiling errors (undefined references). I've already tried to do anything I could imagine, but I've had no success so far. Can you PLEASE help me? :P

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hostel
      wrote on last edited by
      #2

      Re-run qmake?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kretikus
        wrote on last edited by
        #3

        You should check two things in the crypto++ solution

        Configuration Debug: C/C++/Code Generation/Runtime Library -> Multi-threaded Debug DLL (/MDd)
        Configuration Release: C/C++/Code Generation/Runtime Library -> Multi-threaded DLL (/MD)

        And make sure that the "treat wchar as buildin type" setting is set to the same value as Qt.
        AFAIK: /Zc:wchar_t-

        1 Reply Last reply
        0
        • G Offline
          G Offline
          GiveMeMyName
          wrote on last edited by
          #4

          if your problem is still unsolved, try this :

          "Have a try":http://www.qtcentre.org/threads/28809-Compiling-amp-using-Crypto-with-mingw-version-of- Qt

          It worked well for me !

          sehnkimS 1 Reply Last reply
          1
          • G GiveMeMyName

            if your problem is still unsolved, try this :

            "Have a try":http://www.qtcentre.org/threads/28809-Compiling-amp-using-Crypto-with-mingw-version-of- Qt

            It worked well for me !

            sehnkimS Offline
            sehnkimS Offline
            sehnkim
            wrote on last edited by
            #5

            @GiveMeMyName

            I know this topic is kind of old, but I followed the instructions by Kretikus but didn't work. So, I tried to use the link in your post, but it seems it is broken.
            Can you give me some idea of how to solve the issue on your end?

            Here is what I've done so far.

            Even though the build was successful and the dll and lib were generated, there was this error. Do you know why I have the error?

            error: LNK1107: invalid or corrupt file: cannot read at 0x2C0
            

            I googled it and investigated the issue, and it turned out that the solution file (cryptest.sln) was not correct. I followed the following instructions.
            http://stackoverflow.com/questions/33263734/rebuild-crypto-5-6-2-for-md-release-under-visual-studio-2013
            https://cryptopp.com/wiki/Visual_Studio

            But still I have the following errors.

            mainwindow.obj:-1: error: LNK2001: unresolved external symbol "public: virtual unsigned __int64 __thiscall CryptoPP::ThreadUserTimer::GetCurrentTimerValue(void)" (?GetCurrentTimerValue@ThreadUserTimer@CryptoPP@@UAE_KXZ)
            

            Is the following code correct?

            INCLUDEPATH += "../extern/msvc2013/cryptopp562/include"
            LIBS += -L"../extern/msvc2013/cryptopp562/lib" -lcryptopp
            

            Should I also add dll like this?

            LIBS += -L"../build-user_account_registration-Desktop_Qt_5_6_0_MSVC2013_32bit-Release/release/cryptopp.dll"
            

            Any help would be appreciated.
            Thank you so much.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved