Problem when adding webp.lib.
-
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/ -llibwebpQImageReader reader(fileName); if (fileName.toLower().endsWith(".webp")) { reader.setFormat("WEBP"); }
-
@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.
-
@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. -
@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. -
@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 youwin32: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
-
@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/libwebpNow 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
-
-
Hey guys, if OP downloaded
libwebp
from https://developers.google.com/speed/webp/docs/precompiled, the precompiled lib file for Windows is namedlibwebp.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 thelibwebp.lib
file from a file dialog.
The problem is he left theAdd "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. -
@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 leadinglib...
be removed like under Linux? - I still don't get how
-llibwebp
or-llibwebpd
could give the verbatim error messagecannot find -libwebpd
he quotes, they are not the same string?
-
@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.
-
@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!
-
@JonB
Yes, if he uses-llibwebp
the error message should becannot find -llibwebpd
. I think he copied his version of message in the middle of trying to modify theLIBS
.
The standard file name for-lname
in MinGW should bename.lib
orlibname.a
. I think older MinGW will need-llibwebp
instead of-lwebp
for alibwebp.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 linklibwebp
at all, because Qt uses its own webp plugin. -
@Christian-Ehrlicher I use Qt.6.0.0 MinGW 64-bit kit
-
-
@Christian-Ehrlicher However, when recompiling with MSVC, many errors occur. I don't know how to handle this.