 |
|
| Linux Forum Index » Linux Development - Applications » How to change my c++ program's icon?... |
|
Page 1 of 2 Goto page 1, 2 Next |
|
| Author |
Message |
| Dos-Man 64... |
Posted: Mon Sep 21, 2009 6:08 pm |
|
|
|
Guest
|
Is there some way to change the icon of a program compiled with gcc or
g++? I didn't see any compiler options in the man pages. Perhaps the
linker has a switch? |
|
|
| Back to top |
|
|
|
| Dos-Man 64... |
Posted: Mon Sep 21, 2009 7:05 pm |
|
|
|
Guest
|
On Sep 21, 11:32 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid>
wrote:
Quote: Dos-Man 64 wrote:
Is there some way to change the icon of a program compiled with gcc or
g++? I didn't see any compiler options in the man pages. Perhaps the
linker has a switch?
There is no icon compiled into it unless you place one there yourself.
Adding things like that is not the role of the compiler or linker.
What widget set are you working with?
None. This is just a traditional c++ terminal application without any
GUI.
Still, if it was a say a gtk+ app, none of the books I got demonstrate
a method of changing the icon of the executable. I also had some
trouble changing the default application icon for free pascal
applications designed with lazarus. Not sure what the problem was;
just didn't seem to work. Also couldn't change the form.icon property. |
|
|
| Back to top |
|
|
|
| Ryan McCoskrie... |
Posted: Mon Sep 21, 2009 10:32 pm |
|
|
|
Guest
|
Dos-Man 64 wrote:
Quote: Is there some way to change the icon of a program compiled with gcc or
g++? I didn't see any compiler options in the man pages. Perhaps the
linker has a switch?
There is no icon compiled into it unless you place one there yourself.
Adding things like that is not the role of the compiler or linker.
What widget set are you working with? |
|
|
| Back to top |
|
|
|
| Dos-Man 64... |
Posted: Tue Sep 22, 2009 4:15 am |
|
|
|
Guest
|
On Sep 22, 6:02 am, j... at (no spam) toerring.de (Jens Thoms Toerring) wrote:
Quote: Dos-Man 64 <ChairS... at (no spam) mail.com> wrote:
On Sep 21, 11:32 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid
wrote:
Dos-Man 64 wrote:
Is there some way to change the icon of a program compiled with gcc or
g++? I didn't see any compiler options in the man pages. Perhaps the
linker has a switch?
There is no icon compiled into it unless you place one there yourself..
Adding things like that is not the role of the compiler or linker.
What widget set are you working with?
None. This is just a traditional c++ terminal application without any
GUI.
First question is what kind of icon are you talking about?
The default knoppix icon is a blue "gear".
Quote: Do your window manager/desktop environment allows you to
put icons on the screen that, when you click on them, result
in the program getting started and is this the kind of icon
you're talking about?
Yes.
Quote: In that case that's something you have
to adjust in your window mananger/desktop environment since
the program hasn't anything to do with it.
The icon isn't built into the binary? Keep in mind I'm coming from
the MS platform and I'm just used to things being done a certain
way...
Quote: Or do you mean the icon shown when you "iconify" the window
of the program?
No.
Quote:
Still, if it was a say a gtk+ app, none of the books I got demonstrate
a method of changing the icon of the executable.
That's because an "executable" has no icon. It's just a bunch
of bits in a file on your disk. An icon on the desktop back-
ground is a visualisation of this file and the window manager/
desktop environment takes care of such things. So it's the
window manager/desktop environmen you've got to talk to about
the way it visualizes the file as an icon. Nothing within the
"executable" can do that - it's just bits in a file that are
not looked at until you start the program.
Regards, Jens
--
\ Jens Thoms Toerring ___ j... at (no spam) toerring.de
\__________________________ http://toerring.de
So you are saying that the setup or installation program is actually
responsible for changing the application's icon on a target system? |
|
|
| Back to top |
|
|
|
| Rainer Weikusat... |
Posted: Tue Sep 22, 2009 4:48 am |
|
|
|
Guest
|
Dos-Man 64 <ChairShot at (no spam) mail.com> writes:
Quote: On Sep 21, 11:32 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid
wrote:
Dos-Man 64 wrote:
Is there some way to change the icon of a program compiled with gcc or
g++? I didn't see any compiler options in the man pages. Perhaps the
linker has a switch?
There is no icon compiled into it unless you place one there yourself.
Adding things like that is not the role of the compiler or linker.
What widget set are you working with?
None. This is just a traditional c++ terminal application without any
GUI.
Still, if it was a say a gtk+ app, none of the books I got demonstrate
a method of changing the icon of the executable.
The reason for this is that the executable has no icon. An 'icon' is
an image file in some format and it is used by your 'GUI environment',
eg, GNOME, KDE, $window_manager to represent this executable
or rather, a set of files of some type when presenting filesystem
information (slightly simplified) in graphical form to you. This means
you need to change the configuration of 'your GUI', whatever it
happens to be, when you want to change such an association. |
|
|
| Back to top |
|
|
|
| Jens Thoms Toerring... |
Posted: Tue Sep 22, 2009 5:02 am |
|
|
|
Guest
|
Dos-Man 64 <ChairShot at (no spam) mail.com> wrote:
Quote: On Sep 21, 11:32Â pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid
wrote:
Dos-Man 64 wrote:
Is there some way to change the icon of a program compiled with gcc or
g++? Â I didn't see any compiler options in the man pages. Â Perhaps the
linker has a switch?
There is no icon compiled into it unless you place one there yourself.
Adding things like that is not the role of the compiler or linker.
What widget set are you working with?
None. This is just a traditional c++ terminal application without any
GUI.
First question is what kind of icon are you talking about?
Do your window manager/desktop environment allows you to
put icons on the screen that, when you click on them, result
in the program getting started and is this the kind of icon
you're talking about? In that case that's something you have
to adjust in your window mananger/desktop environment since
the program hasn't anything to do with it.
Or do you mean the icon shown when you "iconify" the window
of the program? Then you're out of luck for a program that
runs in a terminal since it doesn't have it's own window
but just sends data to the terminal program that outputs
them and receives data it gets send from the terminal
program. If you "iconify" the window you do that to the
terminal window and what you get is the icon for the termi-
nal window.
Only if the program has it's own window(s) it can ask the
window manager to use a certain pixmap for its windows when
they are in iconified state (using a call of XSetWMHints()).
If the window manager reacts to these hints is then another
question.
Quote: Still, if it was a say a gtk+ app, none of the books I got demonstrate
a method of changing the icon of the executable.
That's because an "executable" has no icon. It's just a bunch
of bits in a file on your disk. An icon on the desktop back-
ground is a visualisation of this file and the window manager/
desktop environment takes care of such things. So it's the
window manager/desktop environmen you've got to talk to about
the way it visualizes the file as an icon. Nothing within the
"executable" can do that - it's just bits in a file that are
not looked at until you start the program.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt at (no spam) toerring.de
\__________________________ http://toerring.de |
|
|
| Back to top |
|
|
|
| Ryan McCoskrie... |
Posted: Tue Sep 22, 2009 2:38 pm |
|
|
|
Guest
|
Dos-Man 64 wrote:
Quote: On Sep 21, 11:32 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid
wrote:
Dos-Man 64 wrote:
Is there some way to change the icon of a program compiled with gcc or
g++? I didn't see any compiler options in the man pages. Perhaps the
linker has a switch?
There is no icon compiled into it unless you place one there yourself.
Adding things like that is not the role of the compiler or linker.
What widget set are you working with?
None. This is just a traditional c++ terminal application without any
GUI.
Still, if it was a say a gtk+ app, none of the books I got demonstrate
a method of changing the icon of the executable. I also had some
trouble changing the default application icon for free pascal
applications designed with lazarus. Not sure what the problem was;
just didn't seem to work. Also couldn't change the form.icon property.
I think the best advise here is forget everything you know about
computers[1].
_ALL_ of it.
Search for "Unix programming"[2] on the web.
Start learning again.
[1] I had to do this as well a while ago.
[2] This will mostly be C and shell script but
the principles are mainly what you need to
learn. |
|
|
| Back to top |
|
|
|
| Dos-Man 64... |
Posted: Tue Sep 22, 2009 6:14 pm |
|
|
|
Guest
|
On Sep 22, 3:38 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid>
wrote:
I think the best advise here is forget everything you know about
Quote: computers[1].
_ALL_ of it.
Search for "Unix programming"[2] on the web.
Start learning again.
[1] I had to do this as well a while ago.
[2] This will mostly be C and shell script but
the principles are mainly what you need to
learn.
Well, I am an excellent C programmer already. Well, that's my opinion
anyway. And I am familiar with shell scripting already. Where I
struggle is in determining how X does some things differently than the
way Microsoft Windows was doing it. It's the same general tasks that
are being performed; it's just a matter of the tasks being done
differently. |
|
|
| Back to top |
|
|
|
| Dos-Man 64... |
Posted: Tue Sep 22, 2009 6:24 pm |
|
|
|
Guest
|
On Sep 22, 1:46 pm, j... at (no spam) toerring.de (Jens Thoms Toerring) wrote:
Quote: Dos-Man 64 <ChairS... at (no spam) mail.com> wrote:
On Sep 22, 6:02 am, j... at (no spam) toerring.de (Jens Thoms Toerring) wrote:
Dos-Man 64 <ChairS... at (no spam) mail.com> wrote:
On Sep 21, 11:32 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid
wrote:
Dos-Man 64 wrote:
Is there some way to change the icon of a program compiled with gcc or
g++? I didn't see any compiler options in the man pages. Perhaps the
linker has a switch?
There is no icon compiled into it unless you place one there yourself.
Adding things like that is not the role of the compiler or linker..
What widget set are you working with?
None. This is just a traditional c++ terminal application without any
GUI.
First question is what kind of icon are you talking about?
The default knoppix icon is a blue "gear".
So I guess it's using KDE as its desktop environment (at least
the last time I looked it was using something like this).
Yes. It is KDE.
Quote: The icon isn't built into the binary? Keep in mind I'm coming from
the MS platform and I'm just used to things being done a certain
way...
Now we got to talk about what you call the "binary". I think
on Windows (but I can't say for sure I have hardly ever used
Windows) when you install a program you often get a single
.exe file. But this file is normally some self-unpacking
archive that contains a lot of components, the final exe-
cutable for the program, DLLs, as well as some sort of
install program and probably also a file for the icon. The
install program then takes care of putting the executable
itself (the one that finally is run), the DLLs and the icon
file in the correct places and tells the part of Windows that
is responsible for the desktop environment to use the icon
file for the desktop icon for the program. I would be asto-
nished if the program itself would contain this icon (but
I could as well be wrong, as I said I have nearly no expe-
rience with Windows).
My understanding is that the icon is inside the windows binary. I can
send you a Windows executable and you can see the same icon I'm
seeing. A default icon will be used unless I change the icon. A lot
of it depends on the programming language that was used. A few
languages or tools can generate executables, but with no actual
control over the application's icon. Well, the point is not really how
windows does it, but that I am trying to figure out how X is doing
it. I'm starting to get the idea that there is a list somewhere of
which programs use which icons, but that's only speculation on my part
based on the responses I've heard. |
|
|
| Back to top |
|
|
|
| Josef Moellers... |
Posted: Wed Sep 23, 2009 12:58 am |
|
|
|
Guest
|
Dos-Man 64 wrote:
Quote: On Sep 22, 1:46 pm, j... at (no spam) toerring.de (Jens Thoms Toerring) wrote:
Dos-Man 64 <ChairS... at (no spam) mail.com> wrote:
Quote: The icon isn't built into the binary? Keep in mind I'm coming from
the MS platform and I'm just used to things being done a certain
way...
Now we got to talk about what you call the "binary". I think
on Windows (but I can't say for sure I have hardly ever used
Windows) when you install a program you often get a single
.exe file. But this file is normally some self-unpacking
archive that contains a lot of components, the final exe-
cutable for the program, DLLs, as well as some sort of
install program and probably also a file for the icon. The
install program then takes care of putting the executable
itself (the one that finally is run), the DLLs and the icon
file in the correct places and tells the part of Windows that
is responsible for the desktop environment to use the icon
file for the desktop icon for the program. I would be asto-
nished if the program itself would contain this icon (but
I could as well be wrong, as I said I have nearly no expe-
rience with Windows).
My understanding is that the icon is inside the windows binary. I can
send you a Windows executable and you can see the same icon I'm
seeing. A default icon will be used unless I change the icon. A lot
of it depends on the programming language that was used. A few
languages or tools can generate executables, but with no actual
AFAIK this is correct: the icon is one of the "resources" inside the
..exe file.
Quote: control over the application's icon. Well, the point is not really how
windows does it, but that I am trying to figure out how X is doing
it. I'm starting to get the idea that there is a list somewhere of
which programs use which icons, but that's only speculation on my part
based on the responses I've heard.
It's not "X" that does it ("X" is just a technique used to display
graphics on a screen, more or less ...) but it's the desktop manager
that does it.
Usually you have a table which maps file ("mime") types to icons.
How exactly this is done exceeds my knowledge.
With konqueror or doplhin (a file browser on kde3 which comes with
kubuntu 8.04), you right-click on the file's icon, left-click
"Properties", left-click on the small spanner next to the "Type:
...."-entry, left-click on the icon and then you can select a new icon
for this file type. Note that this is then used for every file of that
type. Within a file browser, you cannot select an icon for a single file
only (e.g. some company's logo for a package that contains one of the
company's products).
Josef
--
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html |
|
|
| Back to top |
|
|
|
| Josef Moellers... |
Posted: Wed Sep 23, 2009 1:02 am |
|
|
|
Guest
|
Dos-Man 64 wrote:
Quote: On Sep 22, 3:38 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid
wrote:
I think the best advise here is forget everything you know about
computers[1].
_ALL_ of it.
Search for "Unix programming"[2] on the web.
Start learning again.
[1] I had to do this as well a while ago.
[2] This will mostly be C and shell script but
the principles are mainly what you need to
learn.
Well, I am an excellent C programmer already. Well, that's my opinion
anyway. And I am familiar with shell scripting already. Where I
struggle is in determining how X does some things differently than the
way Microsoft Windows was doing it. It's the same general tasks that
are being performed; it's just a matter of the tasks being done
differently.
The main problem is that
- there are things that are done pretty much in the same way and
- there are things that are done completely different (each side
obviously claiming that their method is The Right Way
It's not always easy to distinguish one from another, epsecially if you
can perform the same steps on both platforms but get different results.
Josef, sometimes despairing when having to help his wife on her WinXP
--
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html |
|
|
| Back to top |
|
|
|
| Markku Kolkka... |
Posted: Wed Sep 23, 2009 5:45 am |
|
|
|
Guest
|
|
| Back to top |
|
|
|
| Dos-Man 64... |
Posted: Wed Sep 23, 2009 7:19 pm |
|
|
|
Guest
|
On Sep 23, 4:18 am, Rainer Weikusat <rweiku... at (no spam) mssgmbh.com> wrote:
Quote: Dos-Man 64 <ChairS... at (no spam) mail.com> writes:
There is no general way how you can reconfigure someone else's 'GUI
environment' to display a picture you happen to like. After all, maybe
that someone else doesn't like it. This arguably not what a
marketing department would ideally want to have but I consider this to
be a less serious problem. I, for instance, don't use any icons and
not even a taskbar. Minimized windows just vanish and I can recall
them by selecting them from a list which appears on demand.
Ah, that's what I was wondering. It seems to me to be absurd to spend
a lot of time on an application and not be able to assign an
attractive (and descriptive) icon to it, but I guess it is what it is. |
|
|
| Back to top |
|
|
|
| Josef Moellers... |
Posted: Thu Sep 24, 2009 1:12 am |
|
|
|
Guest
|
Dos-Man 64 wrote:
Quote: On Sep 23, 4:18 am, Rainer Weikusat <rweiku... at (no spam) mssgmbh.com> wrote:
Dos-Man 64 <ChairS... at (no spam) mail.com> writes:
There is no general way how you can reconfigure someone else's 'GUI
environment' to display a picture you happen to like. After all, maybe
that someone else doesn't like it. This arguably not what a
marketing department would ideally want to have but I consider this to
be a less serious problem. I, for instance, don't use any icons and
not even a taskbar. Minimized windows just vanish and I can recall
them by selecting them from a list which appears on demand.
Ah, that's what I was wondering. It seems to me to be absurd to spend
a lot of time on an application and not be able to assign an
attractive (and descriptive) icon to it, but I guess it is what it is.
I think you're confusing two things:
One thing is the file browser: it looks at the file name, maybe the file
contents (first couple of bytes), and shows an icon according to the
file type: all .c files get the same icon, all .tar.gz and .tgz files
get the same icon, all executables get the same icon, etc. While you can
decide to assign a nicer icon to executable files, the file browser will
apply this to *all* executable files.
Another thing is the desktop itself (or the bar at the
bottom/top/wherever of the screen). There you can assign any icon you
want to any application you wish to place on the destop.
E.g. with KDE (I use KDE 3) just right-click on the desktop background,
right-click "New", right-click "Link to Application". Type in some name
for the application, e.g. a remote machine name you wish to ssh to, then
left-click on the gear-wheel-icon and select whatever icon you want to
associate with that machine (you can also use one of your own (select
"Other icons" and right-click "Browse")).
Once you have selected an icon, right-click the "Application" tab and
enter "/usr/bin/ssh <machine name>" in the "Command"-Field. Right-click
on "Advanced Options", then select "Run in terminal". Right-click "OK",
again, right-click "OK" and you have a customized icon for an ssh
connection to your remote machine.
Since you can have several instances of the same application with
varying parameters (e.g. you can have several links to "/usr/bin/ssh",
each one calling ssh with different arguments to connect to different
machines), the file browser cannot use the icon you have assigned to one
of these instances.
HTH,
Josef
--
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html |
|
|
| Back to top |
|
|
|
| Ryan McCoskrie... |
Posted: Thu Sep 24, 2009 1:36 am |
|
|
|
Guest
|
Dos-Man 64 wrote:
Quote: On Sep 22, 3:38 pm, Ryan McCoskrie <ryan.mccosk... at (no spam) invalid.invalid
wrote:
I think the best advise here is forget everything you know about
computers[1].
_ALL_ of it.
Search for "Unix programming"[2] on the web.
Start learning again.
[1] I had to do this as well a while ago.
[2] This will mostly be C and shell script but
the principles are mainly what you need to
learn.
Well, I am an excellent C programmer already. Well, that's my opinion
anyway. And I am familiar with shell scripting already. Where I
struggle is in determining how X does some things differently than the
way Microsoft Windows was doing it. It's the same general tasks that
are being performed; it's just a matter of the tasks being done
differently.
The reason that I said to look those up is because your dealing with a
different way of thinking about programming.
Embedding icons into executables is a cute idea but also kinda' silly
sounding. Why would you want that kind of a feature on a natively command
line operating system? |
|
|
| Back to top |
|
|
|
|
|
All times are GMT - 5 Hours
The time now is Sun Dec 06, 2009 3:11 pm
|
|