0

So I've recently been making a program that detects pixel color changes with GetPixel in C++. Every thing looked as though it would work, until I debugged it. I got an error I'd never seen before. So I went on Google to see what it meant and how to fix it. I found that LNK2019 means that something with an outside varible or varible type is used incorrectly. I looked through the code again and I don't see anything that is used incorrectly (Please forgive me if I'm being a bit stupid, it's my first time). My code is below. (Also, props to anyone that can help me make a window with an invisible foreground and a crosshair in the middle •͜ •)

Long boring code

#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;
        }
    }
}
}

The error

Unresolved Exernal Symbol _WinMain@16 referenced in function "int __cdel invoke_main(void)" (?invoke_main@@YAHXZ) 
Speck
  • 17
  • 3

0 Answers0