Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I give a C++ program an icon?

Tags:

c++

icons

g++

How do I give my C++ program an icon? I'm compiling using g++ on Ubuntu 11.10.

like image 488
John Stimac Avatar asked Oct 30 '11 18:10

John Stimac


3 Answers

On Linux, executables don't have icons. You need to create a .desktop file which you can give an icon. See here for example.

On Windows, you can use resource files to give the files themselves an icon. See here and especially here for an explanation.

like image 170
rubenvb Avatar answered Nov 14 '22 02:11

rubenvb


In addition to what rubenvb and Joe McGrath have already said, note that with Windows, the icon you want to show up as the application's default icon must occur first (i.e. before any other icons) in the resource file.

like image 41
Dabbler Avatar answered Nov 14 '22 02:11

Dabbler


On Windows you can include the icon in the executable yourself. There are programs that add resources to the file. It is not the compiler that adds the resources.

On Linux it is not done in the executable itself. Was answered previously at here

like image 20
Joe McGrath Avatar answered Nov 14 '22 02:11

Joe McGrath