smallB
smallB

Reputation: 17100

Qt doesn't seem to process resource file

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?

Upvotes: 6

Views: 4465

Answers (3)

Donald Duck
Donald Duck

Reputation: 8882

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:

Errors in Compile Output Tab

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 33 MB 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 be completely different.

Upvotes: 4

safe89
safe89

Reputation: 17

I noticed that the the error was like this

[debug/qrc_recourses.o]

That means that the problem is from the resources folder

Just click right on your resource.qrc or ****.qrc folder and then delete missed data the run it again, and I think it will work.

Upvotes: -1

Graeme Rock
Graeme Rock

Reputation: 612

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.

Upvotes: 1

Related Questions