Home > Mobile >  Win32 application not finding icon for window
Win32 application not finding icon for window

Time:05-09

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?

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.

  • Related