- 1 year ago
undefined reference to `__imp_CreateSolidBrush'
The error message "undefined reference to __imp_CreateSolidBrush'" typically occurs in C/C++ code when the linker cannot find the definition of the
CreateSolidBrush` function. It indicates a missing or incorrect linker configuration.
To resolve this issue, you need to link against the appropriate library that provides the CreateSolidBrush
function. In this case, you should link against the gdi32
library, which is the library that contains GDI (Graphics Device Interface) functions such as CreateSolidBrush
.
Here's how you can add the necessary linker flag to fix the issue:
Open your project's linker settings or build configuration.
Look for an option to specify additional libraries or linker flags.
Add the library flag
-lgdi32
to indicate that you want to link against thegdi32
library.Save the changes and rebuild your project.
By adding the -lgdi32
linker flag, you are instructing the linker to link against the gdi32
library, which should provide the definition for the CreateSolidBrush
function.
Please note that the exact steps to modify linker settings may vary depending on your development environment or build system. Refer to the documentation of your specific development tools for more detailed instructions on how to configure the linker.