Important: Please read the Qt Code of Conduct -

undefined reference to `_com_util::ConvertBSTRToString(wchar_t*)'

  • the following is the .pro file,what have I miss,I have include <comutil>
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    greaterThan(QT_MAJOR_VERSION, 4): QT += multimedia

    TEMPLATE = app

    The following define makes your compiler emit warnings if you use

    any feature of Qt which has been marked as deprecated (the exact warnings

    depend on your compiler). Please consult the documentation of the

    deprecated API in order to know how to port your code away from it.


    You can also make your code fail to compile if you use deprecated APIs.

    In order to do so, uncomment the following line.

    You can also select to disable deprecated APIs only up to a certain version of Qt.

    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

    CONFIG += c++11

    INCLUDEPATH += $$PWD/ffmpeg-20200528-c0f01ea-win64-dev/include \

    LIBS += $$PWD/ffmpeg-20200528-c0f01ea-win64-dev/lib/avcodec.lib
    LIBS += -lole32
    LIBS += -loleaut32
    LIBS += -lstrmiids

    SOURCES +=

    HEADERS +=

    FORMS +=

    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target

  • Lifetime Qt Champion

    From here
    seems you also have to link
    comsuppw.lib or comsuppwd.lib

  • Hi, this is actually not a Qt-related error.
    You should learn to read Microsoft API docs, espcially the Requirements part, it tells you the header to include and the lib to link.
    Also, when posting, better to wrap your file content with "code" tag (click </>), that'll make it easier to read.

  • i haved added #pragma comment(lib, "comsuppw.lib") but the problem also exists

  • Lifetime Qt Champion


    Did you try
    LIBS += -lcomsuppw

  • error: cannot find -lcomsuppw

  • Lifetime Qt Champion


    Then maybe you dont have it ?
    What windows version and compiler are you using ?

  • WIN8.1 QT5.12 mingw 64-bit

  • Are you using MinGW kit?
    This is a MSVC lib. You need to install MSVC build tools and use MSVC version of Qt.

Log in to reply