'Win32 application not finding icon for window

I created a icon as a resource

Icon in solution explorer

I checked explorer and it works just fine, my exe now has that icon

Next, I used hIcon to set the icon of my window but it says that IDI_ICON1 is undefined enter image description here

Code:

wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ICON1));

Is there any idea of why this is happening?



Solution 1:[1]

Symbolic constants for resource identifiers (such as IDI_ICON1) are usually stored in a separate header file called Resource.h by default. This allows both the resource script (.rc file) as well as source code to access the same symbols.

To use the constants in source code you need to introduce them through an #include directive. Otherwise the compiler is unable to find them, as the error messages indicates.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 IInspectable