[英]“GradientFill was not declared in this scope” error when including windows.h and wingdi.h
這是代碼:
#include <windows.h>
#include <wingdi.h>
#include <tchar.h>
#include <string>
#include <iostream>
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) //handling the message; all cases should be in logical order
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc;
GRADIENT_RECT rc;
TRIVERTEX vertex[2] ;
//vertex settings...
hdc = BeginPaint(hwnd, &ps);
GradientFill(hdc, vertex, 2, &rc, 1, GRADIENT_FILL_RECT_V);
EndPaint(hwnd, &ps);
break;
}
}
}
我從標題中得到了消息,當我切換wingdi.h和windows.h時,我從wingdi.h文件中得到了很多錯誤。 我使用代碼塊。
GradientFill的文檔會告訴您,哪個標頭聲明一個符號以及要包含的標頭:
標題:WinGdi.h(包括Windows.h)
在WinGdi.h中聲明GradientFill
,您僅應#include <Windows.h>
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.