有一个有关 GetPixel 函数的代码,编译错误,但是似乎出现了不是代码问题的错误,因为在 vscode 中显示问题 0 但是无法弹出小黑框,dev-c++ 中显示 (.text.startup+0x2e): undefined reference to `__imp_GetPixel'。
求助如何修改代码使得功能不变且能编译成功。
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main()
{
HDC hDC=::GetDC(NULL);
POINT pt;
GetCursorPos(&pt);
COLORREF clr=::GetPixel(hDC,pt.x,pt.y);
cout<<GetRValue(clr)<<' '<<GetGValue(clr)<<' '<<GetBValue(clr);
return 0;
}