I created a icon as a resource
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
Code:
wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ICON1));
Is there any idea of why this is happening?
CodePudding user response:
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.