Jump to content
  • Advertisement
Sign in to follow this  
Psychopathetica

VC++ 2010 Express How Do I Change The EXE Icon?

This topic is 2158 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have only the express edition of Visual C++ 2010, but I also have 2012 and 2008 as well. But my major project I'm working on is in 2010 and I don't wanna port it over to 2012. However I ran into a limitation of the express edition. I can't exactly put my own icon for my application. I did a simple Google search for solutions, and one of em (found at http://stackoverflow.com/questions/13248465/setting-executable-icon-in-visual-c-2010-express) was to manually create a resource.rc file (which I assume is by using a text file and changing the extention), and manually put in IDI_APP  ICON  "icon.ico", or whatever name your icon is other than icon. But on top of that you also needed to make changes to your vcxproj.filters and put in this:
 

<ItemGroup>
  <ResourceCompile Include="resource.rc">
    <Filter>Resource Files</Filter>
  </ResourceCompile>
</ItemGroup>


But even after I did that, I receive this error:

1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

So, I tried another solution off Google: http://www.gamedev.net/topic/601819-csetting-icon-for-an-exe/

Only this time I did the solution off the last post in the forum based on manually creating a resource.h file and creating an .rc file, putting the rc file in where it says Resource files in the solution explorer, aaaaaand.... rats. Thats when I end up with this error:

1>..\..\..\..\Jacob's Stuff\Source Code\C++\Bosskillers\Release\Bosskillers.rc(2): fatal error RC1015: cannot open include file 'resource.h'.

Even though the resource.h file is in where all my other headers are. The rest of my project is including all my other headers just fine from the same directory. I am just beyond stumpt at this point and any help is appreciated. Thanks in advance :)

Share this post


Link to post
Share on other sites
Advertisement

I'm not quite shure but i think that you cant use resources in express editions.

You can, but you have to edit the resource file with a text editor or some other resource editor. What is not included is the resource editor itself.

 

To Psychopatyhetica:

Try to right click on the resource file and go to "properties". In the "General" section, make sure that "Item type" is set to "resource".  Also check that your include path for the resource contains the folder where resource.h is.

Share this post


Link to post
Share on other sites

Yea I did all that, and now its saying this:

1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

I also am aware that for some reason the resource.h file needs a blank line at the end, which it has. So now I am stuck on this part. i would have gotten to this post earlier but I've been working a lot lol. Sorry for the late reply tongue.png

 

[EDIT] Found the solution over in stackoverflow!!!

If disabling incremental linking doesn't work for you, and turning off "Embed Manifest" doesn't work either, then search your path for multiple versions of CVTRES.exe.

By debugging with the /VERBOSE linker option I found the linker was writing that error message when it tried to invoke cvtres and it failed.

It turned out that I had two versions of this utility in my path. One at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cvtres.exe and one at C:\Windows\Microsoft.NET\Framework\v4.0.30319\cvtres.exe. After VS2012 install, the VS2010 version of cvtres.exe will no longer work. If that's the first one in your path, and the linker decides it needs to convert a .res file to COFF object format, the link will fail with LNK1123.

(Really annoying that the error message has nothing to do with the actual problem, but that's not unusual for a Microsoft product.)

Just delete/rename the older version of the utility, or re-arrange your PATH variable, so that the version that works comes first.

So VS 2012 corrupted the file. Simply renaming cvtres.exe or deleting it from your VS 2010 folder will have the compiler use the other one. It changed the icon so now I'm happy =D I hope this comes a learning experience to those who have both 2010 and 2012 express editions.

Edited by Psychopathetica

Share this post


Link to post
Share on other sites

If you look in the directory where your *.ico item is for your project you can make a new *.ico and just replace/rename your old one.  Remove it from your project and then re-add it back.  Finally, compile your project and your newly created *.exe should have the icon.

 

Online Icon Maker  works like a charm!

 

Visual C++ Express 2010 doesn't allow creating or updating its resource files.  It makes a standard one on the fly for the project.

Edited by codejockey

Share this post


Link to post
Share on other sites

I've never had problem with the express editions. You just have to know how to work with win32 resources.

What you do with a blank project is simple - you just add a new .rc file to your project. VS will recognize it as a resource file, and will include it in your project, under the Resources filter. It will also try to open it with the designer, but will report that the designer is available only on Pro+ editions. From then on, just edit the file as a regular source code file.

Resource files in win32 have nothing to do with XML. The error message is unfamiliar. I'd suggest - delete the resource file that you created manually and just use the VS Add New Item dialog to add it. From then on, make sure that the icon exits in the project directory. Btw, resources are the way to embed anything in your EXE, ICON is just one of the few predefined categories that get special treatment.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!