Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help my mingW64 has a handicap or my code (help) #22

Open
cool1coder opened this issue Sep 25, 2022 · 1 comment
Open

Help my mingW64 has a handicap or my code (help) #22

cool1coder opened this issue Sep 25, 2022 · 1 comment

Comments

@cool1coder
Copy link

So this is my code (i am trying to make a little joke virus for my friend)

#include <windows.h>
#include
#include <time.h>
void invertscreen() {
int x, y;
x = GetSystemMetrics(SM_CXSCREEN);
y = GetSystemMetrics(SM_CXSCREEN);
while (0 == 0) {
int randx, randy;
randx = rand() % x + 0;
randy = rand() % x + 0;
BitBlt(GetDC(NULL),rand() % x + 0, rand() % y + 0, randx + 200,randy+200,GetDC(NULL),randx,randy,NOTSRCCOPY);
}
}

int main()
{
invertscreen();
}

now once compiling i get this error: c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\mverb\AppData\Local\Temp\cchWKwR9.o:main.cpp:(.text+0xc2): undefined reference to `__imp_BitBlt'
collect2.exe: error: ld returned 1 exit status

if you know please help before i get a handicap :D

@Biswa96
Copy link
Contributor

Biswa96 commented Sep 25, 2022

You have to link it properly. Add -lgdi32 linker option while compiling. See https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-bitblt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants