i found a code on github which takes a screenshot and saves it as a jpeg file. I copied and pasted it in notepad++, saved it, and compiled it with the following command:
g++ -mwindows screenshot.cpp -lgdiplus
and faced the following error:
C:\Users\USER\AppData\Local\Temp\ccTLI53G.o:screenshot.cpp:(.text+0x158): undefined reference to `CreateStreamOnHGlobal@12'
collect2.exe: error: ld returned 1 exit status
it seems to be this line which is causing the problem:
#include <stdio.h>
#include <windows.h>
#include <gdiplus.h>
#include <time.h>
//stuff....
HRESULT res = CreateStreamOnHGlobal(NULL, true, &istream);// this line (line 38)
//stuff....
Any help as to why the code is not working will be highly appreciated...