xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Icons are resources so you need to add the compiled resource file (.res, created from .rc) containing the icon to the link line.
Panarchy's Avatar, Join Date: Nov 2007
Contributor
I see.

Pretty sure it's a .rc, could you please tell me how to include it? (resources.rc)

Thanks in advance,

Panarchy
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
You need to compile it first with a resource compiler (look for rc.exe).

Adding it to the link line is as simple as concatenating the filename to the line, for example suppose you want to add FOO.RES to LINK A.O, you get LINK A.O FOO.RES.
Panarchy's Avatar, Join Date: Nov 2007
Contributor
LOL, that simple?

I'll give it a go.

Thanks
Panarchy's Avatar, Join Date: Nov 2007
Contributor
Thanks, however I couldn't work it out.

Please tell me how do include an icon within the .exe, via the Command-Line.

Thanks in advance,

Panarchy
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Do you have the icon in a .rc file?
Panarchy's Avatar, Join Date: Nov 2007
Contributor
Yes
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
So that needs compiling with the resource compiler to produce a .res file, then you can add the .res filename to the link line.
The resource compiler used to be called rc.exe, but I can't find that under C:\Program Files\Microsoft Visual Studio 9.0. So MS must have renamed it to something else. I have an rc.exe in C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin but that seems like an odd place to keep it; anyway if you have that folder too then that might do the trick.
Panarchy's Avatar, Join Date: Nov 2007
Contributor
Nope, rc is still there.

(all code tags are in order of how they are inputted)

Code:
cl /clr "super.cpp"
I've tried;
Code:
rc    super-resource.rc
And that outputs an .res.

Then using the full command;
Code:
link  "super.obj"  /ASSEMBLYRESOURCE:super-resource.res /out:"Not Super.exe"
Compiles the program, with the same size as when I compile the .exe using the GUI, HOWEVER, no icons.

Please tell me how to get this to work.

Thanks in advance,

Panarchy

Last edited by Panarchy; 14May2009 at 15:16..
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Can you specify the icon in the shortcut properties (Change Icon button)?
If so then it's just a case of checking the resource compiler syntax to find out how to specify which icon is the default.