I’m new to C++, recently I have been learning web-dev languages. I have a problem compliling my first C++ application with the Code::Blocks.
Here is my code, it’s very simple:
#include <windows.h>
using namespace std;
int main()
{
SetCursorPos(2000, 10);
mouse_event(MOUSEEVENTF_LEFTDOWN,0 ,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0 ,0,0,0);
}
But while building, the above produces the following error:
Untitled1.c|2|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'|
||=== Build finished: 1 errors, 0 warnings ===|
The code itself, seems to have no errors to me, but I would like to get some tips from the professionals.
You’re compiling your C++ as C — just change the extension to
.cpp.