Problem Compiling

  • Thread starter Thread starter Weeke
  • Start date Start date
W

Weeke

Guest
So i created a gui, and one of the checkboxes if it is checked i want to display like a crosshair on screen. I put the crosshair function in the checkbox source after double clicking. It shows no errors until i compile.

This is my checkbox function in form.h:

private: System::Void externalCrosshair_checkBox_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
{
DoCrosshair();
}




This is my functions.h

#pragma once

#include <windows.h>
#include <iostream>
#include <math.h>

void DoCrosshair()
{
bool crosshairon = true;
HDC ragedc = NULL;
int crosshairsize = 20;
int cx = 0;
int cy = 0;

ragedc = GetDC(HWND_DESKTOP);
cx = GetSystemMetrics(SM_CXSCREEN) / 2 - ((crosshairsize - 1) / 2);
cy = GetSystemMetrics(SM_CYSCREEN) / 2 - ((crosshairsize - 1) / 2);

if (crosshairon == true)
{
for (int i = 0; i < crosshairsize; i++)
{
SetPixel(ragedc, cx + i, cy + ((crosshairsize - 1) / 2), RGB(255, 0, 0));
SetPixel(ragedc, cx + ((crosshairsize - 1) / 2), cy + i, RGB(0, 0, 255));
}

if (crosshairon == false)

for (int i = 1; i < crosshairsize; i++)
{
SetPixel(ragedc, cx + i, cy + ((crosshairsize - 1) / 2), RGB(0, 0, 0));
SetPixel(ragedc, cx + ((crosshairsize - 1) / 2), cy + i, RGB(0, 0, 0));
}
}
Sleep(33);
}

This is error i get on compilation i just cannot figure out the problem any help would be greatly appreciated.

Severity Code Description Project File Line Suppression State Suppression State
Error LNK2028 unresolved token (0A0003DE) "extern "C" struct HDC__ * __cdecl GetDC(struct HWND__ *)" (?GetDC@@$$J0YAPEAUHDC__@@PEAUHWND__@@@Z) referenced in function "void __cdecl DoCrosshair(void)" (?DoCrosshair@@$$FYAXXZ) Rust_RCS C:\Users\slim\Desktop\Rust_RCS\Rust_RCS\MyForm.obj 1
Error LNK2028 unresolved token (0A0003ED) "extern "C" unsigned long __cdecl SetPixel(struct HDC__ *,int,int,unsigned long)" (?SetPixel@@$$J0YAKPEAUHDC__@@HHK@Z) referenced in function "void __cdecl DoCrosshair(void)" (?DoCrosshair@@$$FYAXXZ) Rust_RCS C:\Users\slim\Desktop\Rust_RCS\Rust_RCS\MyForm.obj 1
Error LNK2028 unresolved token (0A0003FC) "extern "C" int __cdecl GetSystemMetrics(int)" (?GetSystemMetrics@@$$J0YAHH@Z) referenced in function "void __cdecl DoCrosshair(void)" (?DoCrosshair@@$$FYAXXZ) Rust_RCS C:\Users\slim\Desktop\Rust_RCS\Rust_RCS\MyForm.obj 1
Error LNK2019 unresolved external symbol "extern "C" struct HDC__ * __cdecl GetDC(struct HWND__ *)" (?GetDC@@$$J0YAPEAUHDC__@@PEAUHWND__@@@Z) referenced in function "void __cdecl DoCrosshair(void)" (?DoCrosshair@@$$FYAXXZ) Rust_RCS C:\Users\slim\Desktop\Rust_RCS\Rust_RCS\MyForm.obj 1
Error LNK2019 unresolved external symbol "extern "C" int __cdecl GetSystemMetrics(int)" (?GetSystemMetrics@@$$J0YAHH@Z) referenced in function "void __cdecl DoCrosshair(void)" (?DoCrosshair@@$$FYAXXZ) Rust_RCS C:\Users\slim\Desktop\Rust_RCS\Rust_RCS\MyForm.obj 1
Error LNK2019 unresolved external symbol "extern "C" unsigned long __cdecl SetPixel(struct HDC__ *,int,int,unsigned long)" (?SetPixel@@$$J0YAKPEAUHDC__@@HHK@Z) referenced in function "void __cdecl DoCrosshair(void)" (?DoCrosshair@@$$FYAXXZ) Rust_RCS C:\Users\slim\Desktop\Rust_RCS\Rust_RCS\MyForm.obj 1
Error LNK1120 6 unresolved externals Rust_RCS C:\Users\slim\Desktop\Rust_RCS\x64\Release\Rust_RCS.exe 1

Continue reading...
 
Back
Top