A Small Question Regarding Windows Icons

Hi all again,

I wanted to experiment with Windows icons, by setting one in a small application - and I found this on the web: https://github.com/FaultyRAM/windres-rs

There’s a thing I don’t really understand - it says:

You need to install the resource compiler for your target ABI in order for  `windres`  to work. Currently the following compilers are supported:

* `windres.exe`  for GNU targets (included in the [mingw-w64](https://mingw-w64.org/) toolchain)
* `rc.exe`  for MSVC targets (included in the Windows SDK, which can be installed via Visual Studio Installer)

Running “rustup show” in cmd prints:

Default host: x86_64-pc-windows-msvc

stable-x86_64-pc-windows-msvc (default)
rustc 1.33.0 (2aa4c46cf 2019-02-28)

So in order to compile it I have to install Windows SDK, I guess. It’s a rather large package, from what I remember, and it requires Visual Studio 2017 or later, while I’m running Windows 10 with Visual Studio 2015 at the moment. I do not mind installing a new version and downloading the whole SDK needed, but I can’t help but wonder: how better is the MSVC version (target?) compared to GNU? Should one be preferred over other? Or is it possible to painlessly switch between them whenever the need arises?

If in doubt, use MSVC.

You can use windres with almost any Windows SDK. Just install the newest one that works with your Visual Studio version, and it’ll probably have rc.exe in it. No need to use the latest Windows 10 SDK. (I’ve used the Windows 7 SDK’s rc.exe to put icons in executables).

1 Like

Yep, I found some rc.exe in one of the folders, probably got there after the installation of another SDK. Everything compiled just fine, even though I tried to “build” it all in the main() function of the main.rs in src folder first… and it did it seem a little odd, while I was trying to.

Anyway, thank you. I imagine the reason why the MSVC is preferred is because it’s the official foundation from Microsoft? GNU package might give some unexpected issues?

1 Like

Mostly, it’s because the official Windows SDK itself is designed for MSVC. MinGW has to use reverse-engineered, and outdated, C header files, so C code built with MinGW can’t easily use the newest Windows API features.

1 Like