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 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");
        }
    
    JonBJ 1 Reply Last reply
    0
    • JonBJ JonB

      @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?
      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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

      JonBJ M 2 Replies Last reply
      2
      • M MyNameIsQt

        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");
            }
        
        JonBJ Online
        JonBJ Online
        JonB
        wrote on 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 JonBJ 2 Replies Last reply
        2
        • JonBJ JonB

          @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 last edited by MyNameIsQt
          #3

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

          cannot find -libwebpd
          

          Thanks

          jsulmJ 1 Reply Last reply
          0
          • M MyNameIsQt

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

            cannot find -libwebpd
            

            Thanks

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on 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
            0
            • jsulmJ jsulm

              @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 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
              
              
              Christian EhrlicherC B 2 Replies Last reply
              0
              • M MyNameIsQt

                @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
                
                
                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 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
                0
                • JonBJ JonB

                  @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.

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by
                  #7

                  @MyNameIsQt

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

                  -lwebp

                  1 Reply Last reply
                  0
                  • M MyNameIsQt

                    @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 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.

                    JonBJ 1 Reply Last reply
                    1
                    • B Bonnie

                      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.

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on 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?
                      Christian EhrlicherC B 2 Replies Last reply
                      0
                      • JonBJ JonB

                        @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?
                        Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 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

                        JonBJ M 2 Replies Last reply
                        2
                        • Christian EhrlicherC Christian Ehrlicher

                          @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.

                          JonBJ Online
                          JonBJ Online
                          JonB
                          wrote on 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
                          • JonBJ JonB

                            @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 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
                            • Christian EhrlicherC Christian Ehrlicher

                              @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 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
                              • Christian EhrlicherC Christian Ehrlicher

                                @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 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

                                • Login

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