所以我最近制作了一个用C ++中的GetPixel检测像素颜色变化的程序。在调试之前,每件事看起来都会起作用。我收到了一个我从未见过的错误。所以我去谷歌看看它是什么意思以及如何解决它。我发现LNK2019意味着外部变量或变量类型的东西使用不正确。我再次查看了代码并且没有看到任何错误使用的内容(请原谅我,如果我有点愚蠢,这是我的第一次)。我的代码如下。 (另外,任何可以帮助我制作一个窗口看不见的前景和中间的十字准线的人的道具•͜•)
#include <iostream>
#include <Windows.h>
int main() {
//X and Y of center-screen.
int x = 960;
int y = 540;
//Toggling variable
int chk = GetKeyState(VK_INSERT);
int ison = 0;
//Putting it together
POINT center;
center.x = x;
center.y = y;
//-1337 H4CK1NG-
if (ison) {
COLORREF GetCentColorStart = GetPixel(NULL, x, y); //Getting an unchanged variable for comparison
COLORREF GetCentColor; //Getting a changing variable for comparison
while (ison) { //While the cheat is on
GetCentColor = GetPixel(NULL, x, y); //Changing the changed variable (Two lines up)
if (GetCentColor != GetCentColorStart) { //If one isn't the other (If one changed)
keybd_event(VK_LBUTTON, 0, 0, 0); //Click
Sleep(100); //Sleep
keybd_event(VK_LBUTTON, 0, KEYEVENTF_KEYUP, 0); //Stop Clicking
}
}
} else {
if (chk) { //If insert is pressed
if (ison) { // This is toggling
ison = 0;
}
else {
ison = 1;
}
}
}
}
Unresolved Exernal Symbol _WinMain@16 referenced in function "int __cdel invoke_main(void)" (?invoke_main@@YAHXZ)