Results 1 to 5 of 5

Thread: qmake problem with application icon in windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default qmake problem with application icon in windows

    I want to add icon to my application in windows XP,

    I am using QT4.6.2 and mingwin that comes with it.
    I have a folder called "res" in the same folder that .pro file exists. there is a .res file with icon info
    IDI_ICON1 ICON DISCARDABLE "NM.ico"
    NM.ico is also placed in "res" along with qrc file

    when I add RC_FILE = res/nm.rc or RC_FILE = $${PWD}/res/nm.rc or even if I type the full path qmake adds this line to the generated "Makefile"
    windres -i res\nm.rc -o debug\nm_res.o --include-dir=./res

    note that ${PWD} is somehow changed from full path (which documents says it should be) to a simple "."
    This causes problem because "windres" does not know how to locate the icon and crashes, while if it was the full path there was no problem.
    I can run windres with full path but needs me to change the makefile every time that I change the pro file!

    Is there any workarounds?

  2. #2
    Join Date
    Apr 2008
    Posts
    35
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake problem with application icon in windows

    try adding line to your project file with full path and remove the RC_FILE line

    Qt Code:
    1. QMAKE_PRE_LINK = "windres -i C:\fullpath\res\nm.rc -o C:\fullpath\debug\nm_res.o --include-dir=./res"
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Mar 2010
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake problem with application icon in windows

    Thanks for the answer but I still get this message:
    "windres.exe has encountered a problem and needs to close. We are sorry for the inconvenience."

    But I realized that it is Eclipse specific! having set "RC_FILE = res/nm.rc" if I run the following in a normal command prompt the build runs smoothly

    path = C:/Qt/2010.02/qt/bin;C:/Qt/2010.02/mingw/bin
    mingw32-make debug

    I guess I will make a batch file for that and have Eclipse call it!
    somehow the "build environment variable" of Eclipse does not work for windres (although g++ does not have problem !), maybe it is a weird bug in binutils!


    Any thoughts on this is appreciated

  4. #4
    Join Date
    Mar 2010
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake problem with application icon in windows

    Ok that is how I solved this,

    I created a file called "make.bat" and placed it in the project path (where .pro is located)

    the content of make.bat is this:
    path = C:/Qt/2010.02/qt/bin;C:/Qt/2010.02/mingw/bin
    mingw32-make %1

    then to have eclipse use your batch file from Project/Properties/"C/C++ Make Project" enter "make.bat" in the "Build command" section. Now you can build for debug release and clean as usual

  5. #5

    Default Re: qmake problem with application icon in windows

    Test if you have a space in some folder in your path to the project.
    Example: D:\Lab\QtProjects\MyNotepad 1.0

    This make that cannot recognize "windres"

    Do the follow:
    -Delete the pro.user file in your project root directory
    -rename without spaces (Ex: D:\Lab\QtProjects\MyNotepad-1.0)
    -in Qt Creator -> Open Project -> mynotepad.pro (following the example)
    Compile and Voilé.... All ok!!

    Try...

Similar Threads

  1. Setting the Application Icon on Windows
    By Coises in forum Newbie
    Replies: 4
    Last Post: 12th June 2017, 21:41
  2. setting main application icon on windows
    By JeanC in forum Qt Programming
    Replies: 7
    Last Post: 12th June 2017, 06:35
  3. Problem with application icon
    By sanjayshelke in forum Qt Programming
    Replies: 4
    Last Post: 8th September 2009, 11:21
  4. Problem with application version and icon
    By cutie.monkey in forum Qt Programming
    Replies: 3
    Last Post: 18th December 2008, 02:22
  5. Replies: 10
    Last Post: 28th April 2006, 16:48

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.