Problem building .qrc file [SOLVED]
I'm attempting to compile all of the resources used in my application into the executable using the .qrc file. I have roughly 245 MB of files I need included in the .qrc (most of them are .3ds/.stl files with some image files). Previously I was using relative paths to load resources, but this won't work when associating file types with the installed executable. I'm encountering a problem when qmake attempts to build it:
1> Rcc'ing Resources.qrc...
1> In file ....\corelib\tools\qbytearray.cpp, line 1470: Out of memory
After writing the line above, qmake exits. I've tried to increase the stack size from 1Mb to 5Mb, but it didn't change anything.
I'm using Qt 4.8.3/MSVC 2010. Any suggestions would be appreciated!
I think that what you are trying to achieve won't be possible (I may be wrong). rcc translate all your files in one c++ file. That file would really be quiet big since you have 245MB "uncompressed" data.
Did you try to change the compression settings ? Or use the binary option ?
Thanks SGaist for your response. I read that by default rcc.exe uses compression, but I tried using:
rcc.exe -compression 2 -threshold 3 /path/
and that still didn't work. Using the binary option resulted in strange behavior, it actually crashed my command window, which I've never seen before.
I would have tried 9 for compression. Anyway, as I said, trying to embed 245MB worth of data in an executable is not a good idea at all. You should rather have it as an external resource.
What is your original solution to use these files ? And what doesn't work ?
Well, my original solution was that everything is referenced relatively. QIcon("./rsc/logo.ico"), etc.
The reason I wanted to switch, was because I want the application to have the ability to recognize file types (akin to excel files). So that double clicking would open the application, but this causes a problem. When a file is double clicked, the application doesn't use the executable path, it uses the file path. So none of the images show up. The application works fine under normal circumstances.
Why not use absolute path for these files ? You can use "this":http://qt-project.org/doc/qt-4.8/qcoreapplication.html#applicationDirPath then you should be able to access all the files you need
That would work perfectly. Thanks so much. I didn't know that existed.
You're welcome !
Don't forget to update the thread's title to solved if that solution works for you :)