Important: Please read the Qt Code of Conduct -

qrc resources to be compiled

  • Hi,
    I'm brand new on Qt and C++ programming in general....I'm trying to generate an .exe file to run my software without having to run it through Qt.
    here is how my project looks like, with the list of files and the qrc resource attached. Now, if I run the project from Qt everything is ok, but if I try to run the .exe created into the release folder I get "MAP file NOT FOUND", warning I set up in case the file is missing....any clue on why this happens and how can I fix it?

    Thanks a lot in advance

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you getting that error message when trying to load that file from QRC ? That seems highly unlikely since the resource file is compiled in your application.

  • thank you for your quick reply! I do get the error when I run the application (and the project doesn't work as it should) but it works fine, and I don't get any error, if I run the project from Qt.

  • Lifetime Qt Champion

    Just to be sure, when you say your run the exe from the release folder, are you launching it from Window's file explorer ? If so, did you properly deploy your application ?

  • this is what I do:

    1. I run my project from Qt 0_1513670282772_a1ca134d-46f8-484f-a07e-06c4748dc462-image.png
    2. the software creates the folder where it deploys the application along with all the moc_xx.cpp and the qrc_MapFile.cpp is there 0_1513670466273_c8bb8a50-4912-462e-ac97-3b94b61d9425-image.png
    3. I copy the .exe from the deploy folder into the folder from where I want to launch the application 0_1513670614395_5281394f-b400-4455-a5dd-4b726c5bae9e-image.png
      at least this is what I have successfully done with other projects but this is the first time I use a .qrc resource.

    sorry for all the screenshots but hopefully would be easier to understand if I'm missing pieces...

  • Lifetime Qt Champion

    Can you show the content of your .qrc file ?

  • sure! the .qrc is

    <qresource prefix="/MapFile">

    and the .map file is just a list of numbers

  • Lifetime Qt Champion

    Looks good...

    Can you show the code where you load the file ?

  • yep...
    void MainWindow::ReadMap()
    QFile file(":/MapFile/");
    qDebug()<<"MAP FILE NOT FOUND.";

  • Hi SGaist I solved the issue by deploying the application from the command line using the command windeployqt.exe and it works fine. thanks fro your help anyway!

Log in to reply