0

So thats my code:

#include <windows.h>

#include <iostream>
using namespace std;

int main(){
    
    HWND window;
    
    window = GetForegroundWindow();
    
    POINT c;
    
    GetCursorPos(&c);
    int x = c.x;
    int y = c.y;
    SetCursorPos(x,y+100);

    SetWindowPos(window,HWND_TOP,500,500,500,500,SWP_SHOWWINDOW);
    
    return 0;
}

and Thats The error: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\michi\AppData\Local\Temp\ccXraf6i.o:ILoveCPP.cpp:(.text+0xa7): undefined reference to std::ios_base::Init::~Init()' c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\michi\AppData\Local\Temp\ccXraf6i.o:ILoveCPP.cpp:(.text+0xc8): undefined reference to std::ios_base::Init::Init()' collect2.exe: error: ld returned 1 exit status

I want do do an programm that moves the Cursor a little bit and it dont work. (Sorry for my bad english)

273K
  • 29,503
  • 10
  • 41
  • 64
M1chael
  • 63
  • 1
  • 4
  • This does nothing with Windows API and SetWindowPos. Are you able to successfully build the C++ hello word program? – 273K Feb 28 '21 at 16:07
  • 2
    The code works with Visual Studio 2019, so the problem is probably not the code but the compiler and the way you are compiling the program. How are you compiling it? – trenki Feb 28 '21 at 16:08
  • What's the compile command; make sure it's `g++` and not `gcc` ? – Richard Critten Feb 28 '21 at 16:09

0 Answers0