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. Problem when adding webp.lib.
Forum Update on Monday, May 27th 2025

Problem when adding webp.lib.

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 5 Posters 943 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.
  • M Offline
    M Offline
    MyNameIsQt
    wrote on 16 Mar 2023, 18:12 last edited by
    #1

    I'm making a tool to convert images to webp.
    I added the .lib as follows, but I get an error.

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp/ -llibwebp
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp/ -llibwebpd
    else:unix: LIBS += -L$$PWD/webp/ -llibwebp

    QImageReader reader(fileName);
        if (fileName.toLower().endsWith(".webp")) {
            reader.setFormat("WEBP");
        }
    
    J 1 Reply Last reply 16 Mar 2023, 18:20
    0
    • J JonB
      17 Mar 2023, 08:21

      @Bonnie
      Hi @Bonnie, you are doubtless correct, you usually are! But then I don't understand various things:

      • Doesn't it depend on which compiler/linker he is using, which he doesn't say?
      • Doesn't MinGW treat -l... as requiring the leading lib... be removed like under Linux?
      • I still don't get how -llibwebp or -llibwebpd could give the verbatim error message cannot find -libwebpd he quotes, they are not the same string?
      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 17 Mar 2023, 08:30 last edited by
      #10

      @JonB said in Problem when adding webp.lib.:

      cannot find -libwebpd

      This is an error from MinGW so the OP is using MinGW which means libwebp.lib will not work since this is an import lib for MSVC.
      And -lwebp will be correctly change to the correct linker option for MSVC iirc but this doesn't matter here. For MinGW it must be -lwebp.

      Don't know if webp is a c++ or c library but when it's a c++ library then it must be compiled with the same compiler. If it's a c library then on can try to directly link against the dll with MinGW when there is no correct import library (libwebp.a) available. Or create on with the help of pexports and friends.

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

      J M 2 Replies Last reply 17 Mar 2023, 08:34
      2
      • M MyNameIsQt
        16 Mar 2023, 18:12

        I'm making a tool to convert images to webp.
        I added the .lib as follows, but I get an error.

        win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp/ -llibwebp
        else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp/ -llibwebpd
        else:unix: LIBS += -L$$PWD/webp/ -llibwebp

        QImageReader reader(fileName);
            if (fileName.toLower().endsWith(".webp")) {
                reader.setFormat("WEBP");
            }
        
        J Offline
        J Offline
        JonB
        wrote on 16 Mar 2023, 18:20 last edited by
        #2

        @MyNameIsQt
        It always helps to say what the error is when you get one.

        -llibwebp

        Did you see something which told you to type this? Not, say, -lwebp? I don't know, I'm just guessing.

        M J 2 Replies Last reply 17 Mar 2023, 03:37
        2
        • J JonB
          16 Mar 2023, 18:20

          @MyNameIsQt
          It always helps to say what the error is when you get one.

          -llibwebp

          Did you see something which told you to type this? Not, say, -lwebp? I don't know, I'm just guessing.

          M Offline
          M Offline
          MyNameIsQt
          wrote on 17 Mar 2023, 03:37 last edited by MyNameIsQt
          #3

          @JonB
          I'm sorry.
          I should have posted more detailed results.
          I forgot.

          cannot find -libwebpd
          

          Thanks

          J 1 Reply Last reply 17 Mar 2023, 05:17
          0
          • M MyNameIsQt
            17 Mar 2023, 03:37

            @JonB
            I'm sorry.
            I should have posted more detailed results.
            I forgot.

            cannot find -libwebpd
            

            Thanks

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 17 Mar 2023, 05:17 last edited by
            #4

            @MyNameIsQt said in Problem when adding webp.lib.:

            -libwebpd

            This is wrong.
            It should be: -lwebp
            -l is a parameter, what comes afterwards is the name of the library, but without lib prefix and file name extension.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply 17 Mar 2023, 05:53
            0
            • J jsulm
              17 Mar 2023, 05:17

              @MyNameIsQt said in Problem when adding webp.lib.:

              -libwebpd

              This is wrong.
              It should be: -lwebp
              -l is a parameter, what comes afterwards is the name of the library, but without lib prefix and file name extension.

              M Offline
              M Offline
              MyNameIsQt
              wrote on 17 Mar 2023, 05:53 last edited by
              #5

              @jsulm Thank.
              -lwebp gives the same result.
              When I build it after explicitly writing and modifying it as follows, it builds normally. But I haven't loaded the webp image yet. When you load an image, you don't know what processing result will be displayed. thank you

              win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp/libwebp
              else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp/libwebp
              else:unix: LIBS += -L$$PWD/webp/libwebp
              
              INCLUDEPATH += $$PWD/webp
              DEPENDPATH += $$PWD/webp
              
              
              C B 2 Replies Last reply 17 Mar 2023, 06:33
              0
              • M MyNameIsQt
                17 Mar 2023, 05:53

                @jsulm Thank.
                -lwebp gives the same result.
                When I build it after explicitly writing and modifying it as follows, it builds normally. But I haven't loaded the webp image yet. When you load an image, you don't know what processing result will be displayed. thank you

                win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp/libwebp
                else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp/libwebp
                else:unix: LIBS += -L$$PWD/webp/libwebp
                
                INCLUDEPATH += $$PWD/webp
                DEPENDPATH += $$PWD/webp
                
                
                C Offline
                C Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 17 Mar 2023, 06:33 last edited by
                #6

                @MyNameIsQt said in Problem when adding webp.lib.:

                win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp/libwebp
                else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp/libwebp
                else:unix: LIBS += -L$$PWD/webp/libwebp

                Now you don't link at all to the webp library...

                Please do what we suggested and also show us what's in $$PWD/webp/libwebp

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

                M 1 Reply Last reply 17 Mar 2023, 15:54
                0
                • J JonB
                  16 Mar 2023, 18:20

                  @MyNameIsQt
                  It always helps to say what the error is when you get one.

                  -llibwebp

                  Did you see something which told you to type this? Not, say, -lwebp? I don't know, I'm just guessing.

                  J Offline
                  J Offline
                  JonB
                  wrote on 17 Mar 2023, 07:45 last edited by
                  #7

                  @MyNameIsQt

                  @JonB said in Problem when adding webp.lib.:

                  -lwebp

                  1 Reply Last reply
                  0
                  • M MyNameIsQt
                    17 Mar 2023, 05:53

                    @jsulm Thank.
                    -lwebp gives the same result.
                    When I build it after explicitly writing and modifying it as follows, it builds normally. But I haven't loaded the webp image yet. When you load an image, you don't know what processing result will be displayed. thank you

                    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp/libwebp
                    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp/libwebp
                    else:unix: LIBS += -L$$PWD/webp/libwebp
                    
                    INCLUDEPATH += $$PWD/webp
                    DEPENDPATH += $$PWD/webp
                    
                    
                    B Offline
                    B Offline
                    Bonnie
                    wrote on 17 Mar 2023, 08:06 last edited by Bonnie
                    #8

                    Hey guys, if OP downloaded libwebp from https://developers.google.com/speed/webp/docs/precompiled, the precompiled lib file for Windows is named libwebp.lib, so it is ok to use -llibwebp :)
                    And from the content he post, he must have used "Add Library..." wizard in Qt creator and chose the libwebp.lib file from a file dialog.
                    The problem is he left the Add "d" suffix for debug version option checked (may be default), so Qt creator add an extra "d" for debug version, which is wrong in this case.

                    J 1 Reply Last reply 17 Mar 2023, 08:21
                    1
                    • B Bonnie
                      17 Mar 2023, 08:06

                      Hey guys, if OP downloaded libwebp from https://developers.google.com/speed/webp/docs/precompiled, the precompiled lib file for Windows is named libwebp.lib, so it is ok to use -llibwebp :)
                      And from the content he post, he must have used "Add Library..." wizard in Qt creator and chose the libwebp.lib file from a file dialog.
                      The problem is he left the Add "d" suffix for debug version option checked (may be default), so Qt creator add an extra "d" for debug version, which is wrong in this case.

                      J Offline
                      J Offline
                      JonB
                      wrote on 17 Mar 2023, 08:21 last edited by
                      #9

                      @Bonnie
                      Hi @Bonnie, you are doubtless correct, you usually are! But then I don't understand various things:

                      • Doesn't it depend on which compiler/linker he is using, which he doesn't say?
                      • Doesn't MinGW treat -l... as requiring the leading lib... be removed like under Linux?
                      • I still don't get how -llibwebp or -llibwebpd could give the verbatim error message cannot find -libwebpd he quotes, they are not the same string?
                      C B 2 Replies Last reply 17 Mar 2023, 08:30
                      0
                      • J JonB
                        17 Mar 2023, 08:21

                        @Bonnie
                        Hi @Bonnie, you are doubtless correct, you usually are! But then I don't understand various things:

                        • Doesn't it depend on which compiler/linker he is using, which he doesn't say?
                        • Doesn't MinGW treat -l... as requiring the leading lib... be removed like under Linux?
                        • I still don't get how -llibwebp or -llibwebpd could give the verbatim error message cannot find -libwebpd he quotes, they are not the same string?
                        C Offline
                        C Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 17 Mar 2023, 08:30 last edited by
                        #10

                        @JonB said in Problem when adding webp.lib.:

                        cannot find -libwebpd

                        This is an error from MinGW so the OP is using MinGW which means libwebp.lib will not work since this is an import lib for MSVC.
                        And -lwebp will be correctly change to the correct linker option for MSVC iirc but this doesn't matter here. For MinGW it must be -lwebp.

                        Don't know if webp is a c++ or c library but when it's a c++ library then it must be compiled with the same compiler. If it's a c library then on can try to directly link against the dll with MinGW when there is no correct import library (libwebp.a) available. Or create on with the help of pexports and friends.

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

                        J M 2 Replies Last reply 17 Mar 2023, 08:34
                        2
                        • C Christian Ehrlicher
                          17 Mar 2023, 08:30

                          @JonB said in Problem when adding webp.lib.:

                          cannot find -libwebpd

                          This is an error from MinGW so the OP is using MinGW which means libwebp.lib will not work since this is an import lib for MSVC.
                          And -lwebp will be correctly change to the correct linker option for MSVC iirc but this doesn't matter here. For MinGW it must be -lwebp.

                          Don't know if webp is a c++ or c library but when it's a c++ library then it must be compiled with the same compiler. If it's a c library then on can try to directly link against the dll with MinGW when there is no correct import library (libwebp.a) available. Or create on with the help of pexports and friends.

                          J Offline
                          J Offline
                          JonB
                          wrote on 17 Mar 2023, 08:34 last edited by
                          #11

                          @Christian-Ehrlicher said in Problem when adding webp.lib.:

                          This is an error from MinGW so the OP is using MinGW which means libwebp.lib will not work since this is an import lib for MSVC.

                          Thank you!

                          1 Reply Last reply
                          0
                          • J JonB
                            17 Mar 2023, 08:21

                            @Bonnie
                            Hi @Bonnie, you are doubtless correct, you usually are! But then I don't understand various things:

                            • Doesn't it depend on which compiler/linker he is using, which he doesn't say?
                            • Doesn't MinGW treat -l... as requiring the leading lib... be removed like under Linux?
                            • I still don't get how -llibwebp or -llibwebpd could give the verbatim error message cannot find -libwebpd he quotes, they are not the same string?
                            B Offline
                            B Offline
                            Bonnie
                            wrote on 17 Mar 2023, 08:45 last edited by Bonnie
                            #12

                            @JonB
                            Yes, if he uses -llibwebp the error message should be cannot find -llibwebpd. I think he copied his version of message in the middle of trying to modify the LIBS.
                            The standard file name for -lname in MinGW should be name.lib or libname.a. I think older MinGW will need -llibwebp instead of -lwebp for a libwebp.lib file, but more recent versions can accept both.

                            BTW I'm also very confused with OP, if he is using QImageReader/QImageWriter to read/write .webp file, there's no need to link libwebp at all, because Qt uses its own webp plugin.

                            1 Reply Last reply
                            1
                            • C Christian Ehrlicher
                              17 Mar 2023, 08:30

                              @JonB said in Problem when adding webp.lib.:

                              cannot find -libwebpd

                              This is an error from MinGW so the OP is using MinGW which means libwebp.lib will not work since this is an import lib for MSVC.
                              And -lwebp will be correctly change to the correct linker option for MSVC iirc but this doesn't matter here. For MinGW it must be -lwebp.

                              Don't know if webp is a c++ or c library but when it's a c++ library then it must be compiled with the same compiler. If it's a c library then on can try to directly link against the dll with MinGW when there is no correct import library (libwebp.a) available. Or create on with the help of pexports and friends.

                              M Offline
                              M Offline
                              MyNameIsQt
                              wrote on 17 Mar 2023, 15:37 last edited by
                              #13

                              @Christian-Ehrlicher I use Qt.6.0.0 MinGW 64-bit kit

                              1 Reply Last reply
                              0
                              • M MyNameIsQt has marked this topic as solved on 17 Mar 2023, 15:37
                              • C Christian Ehrlicher
                                17 Mar 2023, 06:33

                                @MyNameIsQt said in Problem when adding webp.lib.:

                                win32:CONFIG(release, debug|release): LIBS += -L$$PWD/webp/libwebp
                                else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/webp/libwebp
                                else:unix: LIBS += -L$$PWD/webp/libwebp

                                Now you don't link at all to the webp library...

                                Please do what we suggested and also show us what's in $$PWD/webp/libwebp

                                M Offline
                                M Offline
                                MyNameIsQt
                                wrote on 17 Mar 2023, 15:54 last edited by
                                #14

                                @Christian-Ehrlicher However, when recompiling with MSVC, many errors occur. I don't know how to handle this.

                                1 Reply Last reply
                                0

                                1/14

                                16 Mar 2023, 18:12

                                • Login

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