Home >Backend Development >C++ >Why Is My Code::Blocks Project Showing an Undefined Reference to TextOut Despite Including windows.h?
Problem Description:
Users experiencing an undefined reference error for the TextOut function while attempting to utilize the GDI32 library in Code::Blocks express confusion despite having access to the windows.h header. They seek guidance on linking with the GDI32 library.
Answer:
Contrary to the notion that the GDI32 library needs to be installed, it is already present on the system. The compiler typically includes an import library for system libraries, which establishes a connection between the program and the library on the system. If this is not the case, the Microsoft Windows Platform SDK can be downloaded to obtain the import libraries.
Linking with GDI32:
To link with the GDI32 library, follow these steps:
Alternatively, you can specify the full name of the library, libgdi32.a, but it offers no additional benefit. If the error persists, try providing the full path to the library or specifying the correct library name, such as gdi32.lib for Microsoft Visual C .
For libraries not located in the project's immediate vicinity, use the "..." button to browse and select the library's pathname.
The above is the detailed content of Why Is My Code::Blocks Project Showing an Undefined Reference to TextOut Despite Including windows.h?. For more information, please follow other related articles on the PHP Chinese website!