问题
As described in the Qt-Documentation I have created my icon file with the icon-composer. Then I have inserted in my .pro-file the following line.
ICON = 3D_Modell.icns
While compiling I get the following error:
No rule to make target `../3D', needed by `3D_Modell.app/Contents/Resources/3D_Modell.icns'
Where is the Contents/Resources folder? Where exactly do I put the icns-file. I have put it into the folder where my project and all cpp and h files lie.
回答1:
The instructions suggest you can add the icon manually:
- Create an Info.plist file for your application (using the PropertyListEditor, found in Developer/Applications).
- Associate your .icns record with the CFBundleIconFile record in the Info.plist file (again, using the PropertyListEditor).
- Copy the Info.plist file into your application bundle's Contents directory.
- Copy the .icns file into your application bundle's Contents/Resources directory.
To get access to your application bundle from the finder, right-click on your application and select 'show package contents' from the context menu. This will open a new finder window from which you can navigate to /Contents/Resources/
.
Hope this helps.
EDIT:
The PropertyListEditor utility is in Developer/Applications/Utilities/
. You can use it to "open" your application bundle, and edit the plist (located in the bundle's /Contents/
folder). The CFBundleIconFile
item is helpfully called Icon File
in the editor, but if you select View > Show Raw Keys/Values you can see the actual property names.

回答2:
All we have in our .pro
file is:
macx:ICON = $${PWD}/my_app.icns
The icon is in the same directory as the .pro
file. No manual steps are necessary.
回答3:
Sounds like an issue with the icon name. Try Modell.icns instead.
来源:https://stackoverflow.com/questions/9515726/setting-icon-on-a-mac-with-qt