Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved cmake cannot find libws2_32

    General and Desktop
    cmake qt5 mingw32 windows 10
    2
    3
    141
    Loading More Posts
    • 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.
    • N
      nekkceb last edited by Chris Kawa

      I am using Qt 5.15.10 MinGW-32 in windows 10 and the mingw compiler that installs with Qt:
      Path to compiler is

      C:\Pgms\QtOL\Tools\mingw810_32\bin
      

      I converted this project form .pro to cmake. The .pro relevant line is:

      win32:LIBS += libws2_32
      

      And that has been working fine for several years.
      I've been using the python routine so do the initial conversion from qmake to cmake:

      qmake2cmake ./BIPSFileMgr.pro --min-qt-version 5.15
      

      The corresponding lines in the CMakeLists.txt file are:

      if(WIN32)
          target_link_libraries(BIPSFileMgr PRIVATE
                  libws2_32
              )
          endif()
      

      But after running cmake I get

      cannot find -llibws2_32
      

      I have tried adding explicit path to the libws2_32.a (not .lib as I would expect...)

          target_link_libraries(BIPSFileMgr PRIVATE
              C:/Pgms/QtOL/Tools/mingw810_32/i686-w64-mingw32/lib/libws2_32.a
              # ws2_32
          )
      

      But that gives the same error.
      Can someone point me in a better direction here?

      Christian Ehrlicher 1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion @nekkceb last edited by

        @nekkceb said in cmake cannot find libws2_32:

        libws2_32

        The library is 'ws2_32', not 'libws2_32'

        Qt has to stay free or it will die.

        1 Reply Last reply Reply Quote 1
        • Christian Ehrlicher
          Christian Ehrlicher Lifetime Qt Champion @nekkceb last edited by

          @nekkceb said in cmake cannot find libws2_32:

          libws2_32

          The library is 'ws2_32', not 'libws2_32'

          Qt has to stay free or it will die.

          1 Reply Last reply Reply Quote 1
          • N
            nekkceb last edited by

            Well I feel a bit silly, but I thought I had tried that. Seems to work now though.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post