Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error after creating new QML file.



  • I am working on an application using QML and Qt Creator.

    Everything works as expected until I create a new QML file (in this case called RegistryEntryString.qml but the name does not matter). It is just plain new QML.

    import QtQuick 2.0
    
    Item {
    
    }
    

    After that, when I try to run the application, the following pops up in issues:

    qmlcache_loader.cpp:-1: error: undefined reference to `QmlCacheGeneratedCode::_0x5f__RegistryEntryString_qml::qmlData'
    File not found: qmlcache_loader.cpp
    

    I cannot find meaning and source of this error.
    Restarting Qt Creator does not help. Cleaning the project does not help either.

    When I remove the file, however, everything is fine again.

    Any help with this problem will be greatly appreciated.

    EDIT:
    Just to clarify, I am using Qt 5.12.3.


  • Moderators

    Sounds like a bug and I have never seen it.

    But maybe this will help: you can manually clear QML cache - just remove all cache files from cache location.

    Also, make sure you use some modern Qt version.



  • Yeah, got what is wrong. Qt tries to run your old build, but qrc files does no match.
    All you have to do is,
    1- Be sure you have added your new qml file to qrc.
    2- Delete your build folder (probably the same folder as your source folder)
    3- Build again.



  • Thank you very much.

    Sorry to reply this late, I was away and didn't get an email notification.

    The problem is really caused by some file, which is used, being old. I got it working by modifying the properties file (adding a space and removing it) which probably triggered a clean build and caused similar outcome as you have described.

    The behavior seems like a bug to me.



  • Just ran into this one myself while hopping a build around between Qt versions. Googling error message led here.

    Problem seemed to be a qmlcache_loader.cpp file spat out by the resources system. I thought I was cleaning up all the auto-generated rcc/qrc-related files when changing version, but either hadn't noticed this one before (appears sometime between Qt5.7 and Qt5.10?) or hadn't an issue with it. Adding it to the list of things my "deep clean" script trashes fixed my build.



  • I stumbled upon this today using MinGW (I've been usually using MSVC)... anyway, yeah, it's trying to build with old files and it doesn't find the newly created one. A simple rebuild does the trick.


Log in to reply