Resource files can't be opened Windows 7?

  • I am adding "input.txt" to the Resources in the file a .qrc file. On a Windows XP using the MinGW installation it works correctly. On a Windows 7 Visual Studio 2010 installation no resource files can be opened. The call fails by returning false:

    QFile inputFile(":/input.txt");
    bool err =;
    if (err == false)

    The textfinder.prc file:

    <qresource prefix="/">

    The file has this line:


    I also tried setting a resource pixmap on a Label. The Label correctly shows the label image in the Qt Designer, but not when the application is run.

    How can I get image and text resource files to work on my Windows 7 Qt Creator environment?

    Thank you for any assistance.

  • Your code and your .qrc file look okay to me.

    Did you check whether your .qrc file did properly get compiled into a .cpp file by Qt RCC? And did you check whether the generated .cpp file did properly get compiled into an .obj file by your compiler (either MSVC or MinGW/GCC)? And, finally, did you check whether the .obj file did get linked into your EXE file?

    You could also try:
    @QList<QFileInfo> list = QDir(":/").entryInfoList(QStringList("."), QDir::Files);@

    to enumerate all resources compiled into your app...

Log in to reply

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