Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

icon showing on window but not on .exe file (gtk3 windows7)

Tags:

c

gcc

gtk3

I'm compiling a c application with gcc that uses gtk3

I use the gtk_window_set_icon() to set icon, and it shows on the window and the taskbar.

I want to know how can I compile my application so that the file .exe itself has the same icon. (i.e. when I open up the folder where the .exe is located I would see the icon on the .exe file, before even launching the program)

any idea ?

(Note, I am running this on windows 7 64bit)

like image 714
Red Star Avatar asked Dec 06 '25 05:12

Red Star


1 Answers

In fact GTK has nothing to do with. GTK is a library for graphical user interface. But here what you want is to manage your exectuable file.

Since you're on Windows, this is achived by using a resource file. For an icon you can have something like this (name it resource.rc for example):

1 ICON test.ico

Then with the gcc suite, you can use windres to compile this:

windres resource.rc resource.o

And now compile and link all together:

gcc test.c resource.o
like image 176
mikedu95 Avatar answered Dec 07 '25 20:12

mikedu95