Difference between revisions of "Setting an executable icon"

From HaskellWiki
Jump to: navigation, search
m
m
 
Line 11: Line 11:
 
* Save the favicon as favicon.ico in the directory of your application
 
* Save the favicon as favicon.ico in the directory of your application
 
* Create the file Icon.rc, with the contents:
 
* Create the file Icon.rc, with the contents:
<code>
+
<pre>
 
1 ICON "favicon.ico"
 
1 ICON "favicon.ico"
</code>
+
</pre>
 
* generate an object file with the command:
 
* generate an object file with the command:
<code>
+
<pre>
 
windres -i Icon.rc Icon.o
 
windres -i Icon.rc Icon.o
</code>
+
</pre>
 
* Compile your Haskell program with a command like:
 
* Compile your Haskell program with a command like:
<code>
+
<pre>
 
ghc Nop.hs Icon.o
 
ghc Nop.hs Icon.o
</code>
+
</pre>
 
Now you will see the Haskell logo as the icon for Nop.exe in the file manager.
 
Now you will see the Haskell logo as the icon for Nop.exe in the file manager.
   

Latest revision as of 01:31, 14 July 2021

This article is a stub. You can help by expanding it.


Introduction

Many operating systems display icons for executables in their file manager windows. The following shows how to add icons to executables compiled from Haskell source. The examples use the haskell.org favicon.


Windows

  • Save the favicon as favicon.ico in the directory of your application
  • Create the file Icon.rc, with the contents:
      1 ICON "favicon.ico"
  • generate an object file with the command:
      windres -i Icon.rc Icon.o
  • Compile your Haskell program with a command like:
      ghc Nop.hs Icon.o

Now you will see the Haskell logo as the icon for Nop.exe in the file manager.


Linux

A description how to do this in Ubuntu: Create desktop icon executable on Ubuntu Linux