Google really is your friend!

I’m learning Qt, as you all know (from my previous post). And am working my way through some exercises and demos in the SDK and some library books. (Thank goodness for online libraries, eh? My days of lugging thick textbooks are long over!)

And you know that old adage of “You don’t know what you’ve got till it’s gone“? (thx to spellbinder of #create with the reminder)

Oh boy! Did it hit me this past weekend! My router has been giving me fits for the past week, and it was out sporadically over the weekend and whole day on Monday. I was trying to troubleshoot the following error of why Qt won’t compile the Resource.qrc file for a whole day, and Google Search helped me with the workaround in like 5 minutes, when I finally was able to get online ! (bypassed router, tyvm, am on Ethernet LAN cable)

Some background: I was following a tutorial on how to use Resources in Qt to have icons and images in your app. But the images won’t show up! See image at end of post.

Here’s the error of my coding issues in Qt Creator Compile output:

*** [debug/qrc_Resources.cpp] Error 2

Not very informative, is it? And in Qt Command Prompt output, which is more verbose:

H:\MyDocs\QtProjects\icontest>make b:\Tools\QTSdk\4.8.3\bin\qmake.exe -spec b:\Tools\QTSdk\4.8.3\mkspecs\win32-g++
CONFIG+=debug CONFIG+=declarative_debug -o Makefile
The system cannot find the path specified.
The system cannot find the path specified.
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `H:/MyDocs/QtProjects/icontest'
Makefile.Debug:150: warning: overriding commands for target `debug/qrc_resources.o'
Makefile.Debug:147: warning: ignoring old commands for target `debug/qrc_resources.o'
Makefile.Debug:156: warning: overriding commands for target `debug/qrc_resources.o'
Makefile.Debug:150: warning: ignoring old commands for target `debug/qrc_resources.o'
<strong>bin\rcc.exe</strong> -name Resources Resources.qrc -o debug\qrc_Resources.cpp
process_begin: CreateProcess(NULL, bin\rcc.exe -name Resources Resources.qrc -o
debug\qrc_Resources.cpp, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make[1]: *** [debug/qrc_Resources.cpp] Error 2
mingw32-make[1]: Leaving directory `H:/MyDocs/QtProjects/icontest'
mingw32-make: *** [debug] Error 2

And the issue is that, on line#12, the make script is trying to find the rcc.exe in a /bin subdirectory, when that subdirectory does not exist. The PATH has been set to

— PATH set to B:\Tools\QTSdk\4.8.3\bin

on my system, and there’s no such path as

— PATH set to B:\Tools\QTSdk\4.8.3\bin\bin

…and so the failures occured.

The aforementioned Google searches returned this link where the pertinent part that was helpful was the reply by ihall_mps:

If you edit the line in your Makefile.Debug, to remove “bin\”, it works.

While that instruction is fine for editing one project, I’m not going to do that every single time, now am I? So, I found a semi-permanent workaround via another search result, in which Daniel Frömmel instructs to

1) open the qmake.conf of your platform (for me its C:\Qt\4.8.3\mkspecs\win32-g++)
2) search for QMAKE_IDC
3) add the following line after the QMAKE_IDC line:
4) save file and clsoe
5) restart all your dev tools and remove all auto generated Makefiles
6) recompile

Before and after images of an app with the default generic icon and the result of the above fixes.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s