Results 1 to 8 of 8

Thread: Problem putin icon in the .exe file

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Problem putin icon in the .exe file

    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

  2. #2
    Join Date
    Sep 2011
    Posts
    1,245
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem putin icon in the .exe file

    my guess is it cant find file...


    perhaps you should give more error information. did you add qrc file to the pro file?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem putin icon in the .exe file

    Quote Originally Posted by amleto View Post
    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].

  4. #4
    Join Date
    Sep 2011
    Posts
    26
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem putin icon in the .exe file

    Can you post your .pro File ?

  5. #5
    Join Date
    Sep 2011
    Posts
    1,245
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem putin icon in the .exe file

    Quote Originally Posted by Momergil View Post
    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:
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,734
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Problem putin icon in the .exe file

    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.

  7. #7
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem putin icon in the .exe file

    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:
    Qt Code:
    1. IDI_ICON1 ICON DISCARDABLE "myappico.ico"
    To copy to clipboard, switch view to plain text mode 
    Finally, assuming you are using qmake to generate your makefiles, add this line to your myapp.pro file:
    Qt Code:
    1. RC_FILE = myapp.rc
    To copy to clipboard, switch view to plain text mode 
    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.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  8. #8
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem putin icon in the .exe file

    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:

    icon.jpg

    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
    Last edited by Momergil; 6th August 2012 at 17:25.

Similar Threads

  1. How Set Icon To Exe File
    By METEOR7 in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2011, 00:09
  2. Replies: 0
    Last Post: 17th March 2010, 13:25
  3. Save Icon in a file
    By prashant in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2009, 18:07
  4. How to get a file's icon
    By sophister in forum Qt Programming
    Replies: 2
    Last Post: 24th April 2009, 17:22
  5. set Icon to .app file
    By vishal.chauhan in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 21:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.