Cannot run a Qt application on another computer - missing resources



  • My application works fine on the computer I developed it on but as soon I try to run the application on another computer, it crashes.

    I have copied over every single dll file to the folder where the exe is, I do not got any errors about missing dll files.

    An attempt was made to debug the application and it seems to not being able to load resources.

    [code]QGLSceneNode* myScene = QGLAbstractScene::loadScene(QLatin1String(":/model.3ds"));[/code]

    myScene is NULL after doing this so I assume that something about resource loading went wrong.

    Also, I can run another Qt application without any problem, that one do not use resources however.

    Can anyone please help me?


  • Moderators

    Is the resource built into your app, or loaded externally?



  • I assume that the resource should be build into the exe. No idea how to check that for sure. I used Qt Creator to build the application, and I added the resource file to the project and then used the resource editor to add the files. Then in the project file, you can read:

    [code]RESOURCES +=
    models.qrc[/code]


  • Moderators

    Mhm, so it's built-in. You would definitely have known if it was loaded elsewhere. Try adding "qrc" at the beginning od the URL, or at least use QUrl instead of QL1String. Also, would be nice to see how you have declared the entry int .qrc (paste it here, please, together with prefix line).



  • Okay, the new code looks like something like this:

    [code]QGLSceneNode* myScene = QGLAbstractScene::loadScene(QUrl("qrc:/model.3ds"));[/code]

    And the qrc file looks like this:

    [code]<RCC>
    <qresource prefix="/">
    <file>model.3ds</file>
    <file>testcube3ds.3ds</file>
    <file>driller.3ds</file>
    <file>testcube3ds.3ds</file>
    <file>tester.3ds</file>
    <file>ttable.3ds</file>
    <file>clamp.3ds</file>
    </qresource>
    </RCC>[/code]

    I cannot get it to work anyways.

    UPDATE: I did a test with this code and "size" seems to return the correct size of the file.

    [code]int main(int argc, char *argv[])
    {
    Q_INIT_RESOURCE(models);

    QResource* res = new QResource(":/ttable.3ds");
    bool fileexsists = res->isValid();
    int size = res->size();
    
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    
    return a.exec&#40;&#41;;
    

    }[/code]

    But it crashes when I try to load ttable.3ds using Qt3D. I might have forgot to do something in order to make Qt3D to work on any computer.



  • Does it work when the file is not in the resource? I remember for example QSound could not play from a resource file, maybe other similar limitations exist...



  • I recently discovered that there might be no problems with the Resources it self, it is rather something about Qt3D that do not work. It could be some missing plugins that are needed to load 3ds file format.

    EDIT: Yes it is. I saw the following error message in the output:

    [quote]Could not create handler for format - check plugins are installed correctly in C:\Qt\4.8.1\plugins[/quote]


Log in to reply
 

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