Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cannot run a Qt application on another computer - missing resources
Forum Updated to NodeBB v4.3 + New Features

Cannot run a Qt application on another computer - missing resources

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CheatCat
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

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

      (Z(:^

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CheatCat
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          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).

          (Z(:^

          1 Reply Last reply
          0
          • C Offline
            C Offline
            CheatCat
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • U Offline
              U Offline
              utcenter
              wrote on last edited by
              #6

              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...

              1 Reply Last reply
              0
              • C Offline
                C Offline
                CheatCat
                wrote on last edited by
                #7

                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]

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved