www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Error compiling HDC

reply Scrappy <Scrappy_member pathlink.com> writes:
in a standard WinApi programme with windows.h as the only header file, if I put:

case WM_PAINT:
HDC hDC;
PAINTSTRUCT Ps;
hDC = BeginPaint(hwnd, &Ps);
TextOut(hDC, 50, 42, "Blah Blah Blah", 13);
EndPaint(hwnd, &Ps);
break;

for one the the WndProc cases for the msg argument, when I try to compile I get
this: Error 42: Symbol Undefined _TextOutA 20
If I remove the TextOut line it compiles (but does nothing ofc).  It also screws
up with SetBkColor and the same error.  Any suggestions? Thanks in advance.
Dec 25 2003
parent reply Jan Knepper <jan smartsoft.us> writes:
Add GDI32.LIB to your program's link phase.
Also... You might want to use DrawText instead of TexOut.

HTH


Scrappy wrote:
 in a standard WinApi programme with windows.h as the only header file, if I
put:
 
 case WM_PAINT:
 HDC hDC;
 PAINTSTRUCT Ps;
 hDC = BeginPaint(hwnd, &Ps);
 TextOut(hDC, 50, 42, "Blah Blah Blah", 13);
 EndPaint(hwnd, &Ps);
 break;
 
 for one the the WndProc cases for the msg argument, when I try to compile I get
 this: Error 42: Symbol Undefined _TextOutA 20
 If I remove the TextOut line it compiles (but does nothing ofc).  It also
screws
 up with SetBkColor and the same error.  Any suggestions? Thanks in advance.
 
 
-- ManiaC++ Jan Knepper
Dec 25 2003
parent Scrappy <Scrappy_member pathlink.com> writes:
Thanks loads! I just put #pragma comment(lib, "gdi32.lib") in with my includes
and it all works great now!

Add GDI32.LIB to your program's link phase.
Also... You might want to use DrawText instead of TexOut.

HTH
Dec 28 2003