Home >Backend Development >C++ >How to Resolve Undefined Reference Errors When Linking to the GDI32 Library in Code::Blocks?
Linking to the GDI32 Library in Code::Blocks: Resolved
In Code::Blocks, linking to external libraries can be a stumbling block, especially for beginners. A common issue is the undefined reference error when using GDI32 library functions like TextOut, despite having the windows.h header included.
The solution lies in linking your program with the GDI32 import library. This import library is a precompiled file that contains the necessary information for the linker to create references to functions and data in the GDI32 system DLL.
To link with GDI32 in Code::Blocks:
Recompile your program and the undefined reference error for TextOut should be gone. This process applies to other system libraries as well. It is also possible to link with libraries located in non-standard locations by providing the full pathname in the "Link libraries" section.
The above is the detailed content of How to Resolve Undefined Reference Errors When Linking to the GDI32 Library in Code::Blocks?. For more information, please follow other related articles on the PHP Chinese website!