Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt doesn't seem to process resource file

Tags:

qt

I've created resource file in Qt, and I try to access those resources from my application but I'm getting an error:

:-1: error: [debug/qrc_Resources.cpp] Error 2  

Where my resource file is called Resource.qrc. Any ideas how to overcome it?

like image 581
smallB Avatar asked Dec 09 '12 11:12

smallB


2 Answers

This error can be caused by a lot of different things. It's a stupid error because it just tells you there is an error without telling you directly what the error is. But you can find out what caused the error by going to the Compile Output tab. Usually the cause of the error is the first thing in red. This is what I had in my case:

enter image description here

Here the first thing in red (which I circled in orange to make it visible) says "virtual memory exhausted: Cannot allocate memory" which means that the compiler was out of memory (which makes sense because my qrc_resource.cpp file was 33MB large).

What you should do to solve the problem depends on what the cause of the error is. In my case, since the compiler was out of memory, the solution was to allow my virtual machine to use more memory. But if the cause of your error is different, the solution for you might completely different.

It's really stupid that it just says "error 1" and nothing else and you have to look at the compile output to find out what the error actually is. I wish they will fix that in a future version of GCC. In the mean time, you can see what the error is in the Compile Output tab.

like image 86
Donald Duck Avatar answered Oct 21 '22 08:10

Donald Duck


It may be a syntax error - check that Resource.qrc is not referencing any invalid files and there are no typos.

I received "Error 1" when I was having this problem because I deleted one of the resources without editing my resource.qrc.

Also it is suspicious that the .cpp is called qrc_Resources plural, but the .qrc is called Resource singular.

like image 1
Graeme Rock Avatar answered Oct 21 '22 08:10

Graeme Rock