PDA

View Full Version : Problem putin icon in the .exe file



Momergil
4th August 2012, 16:18
Hello!

I want to put an icon to the .exe file. I followed the instructions displayed in Qt Assistant (http://doc.qt.nokia.com/4.7-snapshot/appicon.html) but my problem is in the line


Regenerate your makefile and your application.

I'm not very friendly of this programmer-languages, I must admit, so what I understood and did was to

1. Clean all
2. Run qmake
3. Build all

All fine till step 3, when a error message appears saying


[release/myapp_res.o] Error 1
File not found:

I guess the compiler/qmake is failing to create the .o file as it normally does without problems for the other files of the project, but I have not idea of what is happening for it to fail. This occurs both with release and debug mode.


I'ld appreciate any help.

Thanks,

Momergil

amleto
4th August 2012, 16:23
my guess is it cant find file...


perhaps you should give more error information. did you add qrc file to the pro file?

Momergil
4th August 2012, 19:36
my guess is it cant find file...


perhaps you should give more error information. did you add qrc file to the pro file?

well, that was the unique error information I got. no, it has nothing of qrc file; everything runs fine without the icon; but in the moment I add that line to project file, this error appears.

add: I don't think it's a matter of not finding the file, because at least if the compiler is creating it and puting it elsewhere in the system, the file don't exist [in the project's files].

Naahmi
4th August 2012, 19:52
Can you post your .pro File ?

amleto
4th August 2012, 23:52
well, that was the unique error information I got. no, it has nothing of qrc file; everything runs fine without the icon; but in the moment I add that line to project file, this error appears.

add: I don't think it's a matter of not finding the file, because at least if the compiler is creating it and puting it elsewhere in the system, the file don't exist [in the project's files].

Well, that was the unique error information I got.
You didnt post the full error.


but in the moment I add that line to project file
What line? Hiding details again...

add: I don't think it's a matter of not finding the file
Well something disagrees with you...


[release/myapp_res.o] Error 1
File not found:

ChrisW67
6th August 2012, 05:09
My crystal ball is back from the shop but it is still running rough. I suspect you are doing one of these things:

Specifying an RC_FILE that does not exist. If it doesn't exist then it cannot be built.
Specifying and RC_FILE that points at a broken rc file. If exists but is invalid then it cannot be built.


Read the full command and error message output for some idea what is happening/not happening. When you still cannot work it out copy and paste the command(s) that are failing along with any associated error message. You can find this information in the "Compile Output" panel in Qt Creator, your console if you are building from the command line. Qt Creator even highlights the interesting bits in red. In this case there is likely to be earlier error messages than the one you gave us.

sonulohani
6th August 2012, 07:37
Setting the Application Icon on Windows
First, create an ICO format bitmap file that contains the icon image. This can be done with e.g. Microsoft Visual C++: Select File|New, then select the File tab in the dialog that appears, and choose Icon. (Note that you do not need to load your application into Visual C++; here we are only using the icon editor.)
Store the ICO file in your application's source code directory, for example, with the name myappico.ico. Then, create a text file called, say, myapp.rc in which you put a single line of text:

IDI_ICON1 ICON DISCARDABLE "myappico.ico"
Finally, assuming you are using qmake to generate your makefiles, add this line to your myapp.pro file:

RC_FILE = myapp.rc
Regenerate your makefile and your application. The .exe file will now be represented with your icon in Explorer.
If you do not use qmake, the necessary steps are: first, run the rc program on the .rc file, then link your application with the resulting .res file.

Momergil
6th August 2012, 17:25
Thanks for the answers!


Can you post your .pro File ?


You didnt post the full error.


What line? Hiding details again...

Better answering all this with a printscreen:

8102

So, there it is the .pro file and the error message I get.

The line I'm talking about is line 28, the unique line I had to add in the .pro file in accord with the instructions.


Well something disagrees with you...

Sorry, misunderstanding: what I meant by "not finding the file" I wasn't refering to myapp_res.o, but its quite obvious that it's not finding this because this is not being created - so actually the problem is not finding the file, but creating it; that's what I mean.

sonulohani, as I sad in the first post, that was exactly what I did.


Specifying an RC_FILE that does not exist. If it doesn't exist then it cannot be built.

It can't be that because, as I sad, it followed the instructions completely - the .rc file is in the project's directory as the instructions says.


Specifying and RC_FILE that points at a broken rc file. If exists but is invalid then it cannot be built. Read the full command and error message output (...)

If by the "full error" means to click with the right mouse button and in "show output", here it is:


12:54:07: Running build steps for project LifeDebugger...
12:54:07: Configuration unchanged, skipping qmake step.
12:54:07: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
c:\qtsdk\desktop\qt\4.8.0\mingw\bin\qmake.exe -spec ..\..\..\..\QtSDK\Desktop\Qt\4.8.0\mingw\mkspecs\w in32-g++ CONFIG+=release -o Makefile LifeDebugger.pro
C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Release
mingw32-make.exe[1]: Entering directory `C:/Users/Endrigo/Desktop/LifeDebugger'
windres -i myapp.rc -o release\myapp_res.o --include-dir=. -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
mingw32-make.exe[1]: Leaving directory `C:/Users/Endrigo/Desktop/LifeDebugger'
windres: icon file `myappico.ico' does not contain icon data
mingw32-make.exe[1]: *** [release/myapp_res.o] Error 1
mingw32-make.exe: *** [release] Error 2
12:54:10: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project LifeDebugger (target: Desktop)
When executing build step 'Make'

So, good typ ChristW67; it seems that the problem is "icon file `myappico.ico' does not contain icon data". Maybe the way I created the icon file was invalid - I saved it from a normal png image to the .ico format in Paint.
Any guess how can I create the icon again in a valid way? (note: I don't have that Microsoft software). I'll see if I can do it with CorelDraw.

Added after 14 minutes:

Ok, I got it: I used the website converticon.com to convert the .png file to icon format and this time it worked fine; no compiler errors. The .exe is with the icon file.


Thanks for the help!


Momergil