Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. cmake cannot find libws2_32
QtWS25 Last Chance

cmake cannot find libws2_32

Scheduled Pinned Locked Moved Solved General and Desktop
cmakeqt5mingw32windows 10
3 Posts 2 Posters 967 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.
  • N Offline
    N Offline
    nekkceb
    wrote on 9 Oct 2022, 15:13 last edited by Chris Kawa 10 Sept 2022, 17:03
    #1

    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?

    C 1 Reply Last reply 9 Oct 2022, 16:08
    0
    • N nekkceb
      9 Oct 2022, 15:13

      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?

      C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 9 Oct 2022, 16:08 last edited by
      #2

      @nekkceb said in cmake cannot find libws2_32:

      libws2_32

      The library is 'ws2_32', not 'libws2_32'

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • N Offline
        N Offline
        nekkceb
        wrote on 9 Oct 2022, 18:13 last edited by
        #3

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

        1 Reply Last reply
        0

        3/3

        9 Oct 2022, 18:13

        • Login

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