QMimeTypes library is missing in Qt Creator



  • Hello,
    I have a binary stl file but in the code I need to convert this file to Ascii. When I searched on the web, there is a library which is called QMimeType and another one is QMimeDatabase added to Qt. But my Qt Creator gives error when I add these to my code. Error is: no such file or director.
    How can I solve this problem? Thank you in advance.


  • Moderators

    @aysenur
    how does your include statement look like?



  • #include <QMimeType>
    #include <QMimeDatabase>
    When I write these, Qt Creator gives error no such file or directory error.



  • Hi,
    can you please paste your .pro file here?


  • Moderators

    @aysenur
    thats strange, since those are part of QtCore.
    How does your .pro file look like?



  • My pro file code:
    QT += core gui opengl

    Seems to be necessary on Linux

    unix: LIBS += -lGLU

    TARGET = stl-viewer
    TEMPLATE = app

    Setup an installation target

    target.path = /usr/bin
    INSTALLS += target

    SOURCES += main.cpp
    mainwindow.cpp
    stlview.cpp
    form.cpp

    HEADERS += mainwindow.h
    stlview.h
    form.h

    FORMS += mainwindow.ui
    form.ui

    RESOURCES +=
    resource.qrc


  • Moderators

    @aysenur
    but your project compiles even QtCreator says the file doesn't exist?



  • Sorry I send the pro file which only has QtMimeData library.

    QT += core gui opengl

    Seems to be necessary on Linux

    unix: LIBS += -lGLU

    TARGET = stl-viewer
    TEMPLATE = app

    Setup an installation target

    target.path = /usr/bin
    INSTALLS += target

    SOURCES += main.cpp
    mainwindow.cpp
    stlview.cpp
    form.cpp

    HEADERS += mainwindow.h
    stlview.h
    form.h

    FORMS += mainwindow.ui
    form.ui

    RESOURCES +=
    resource.qrc

    If you compile this code you will see the error. This code looks to the file under /usr/include/qt4 and qt4 does not have mimetype library files. I downloaded qt5.7 now and I will create a new project which will work with 5.7.



  • I have qt4 under /usr/include and also in home directory qt5.7. My Qt Creator looks the files under qt4. How can I change this? Do I need to erase qt4 files and copy qt5.7 files under /usr/include? Thank you inadvance.


  • Lifetime Qt Champion

    Hi,

    No you don't. Go to the Build and Run part of Qt Creator's settings. There add your Qt 5.7 to the Qt versions if not available and then create a kit using it. Finally, build your project using that kit.



  • Thank you so much. I have downloaded Qt5.9.1 and deleted the Desktop kit which looks to qt4. Opened the project again and selected Desktop kit for 5.9.1. System does not give error for QMimeType library anymore.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.