Hi
Ich habe in einem anderem Forum ein "Tutorial" zur Mausbewegung gefunden und rumprobiert.
Es funktionierte alles ganz gut bis ich den aller selben Code auf mein Netbook kopierte und ihn dort erstellte.
Erstmal hier der Code:
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include <windows.h>
#include <iostream>
using namespace std;
// Initialisiert die Maus und gibt die Anzahl der Maustasten zurück
DWORD mouseInit ()
{
DWORD mode;
GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),&mode);
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),mode|ENABLE_MOUSE_INPUT);
DWORD buttons;
GetNumberOfConsoleMouseButtons(&buttons);
return buttons;
}
// Zeigt oder versteckt den Mauscursor
void showCursor (bool show = true)
{
ShowCursor(show);
}
int main ()
{
mouseInit();
showCursor();
bool running = true;
do
{
DWORD count;
INPUT_RECORD ir;
ReadConsoleInput(GetStdHandle(STD_INPUT_HANDLE),&ir,1,&count);
switch(ir.EventType)
{
case KEY_EVENT:
running = false; // Beenden bei Tastendruck
break;
case MOUSE_EVENT:
cout << "X: " << ir.Event.MouseEvent.dwMousePosition.X;
cout << " Y: " << ir.Event.MouseEvent.dwMousePosition.Y;
if(ir.Event.MouseEvent.dwButtonState & FROM_LEFT_1ST_BUTTON_PRESSED)
cout << " | Linke Taste gedrueckt!";
if(ir.Event.MouseEvent.dwButtonState & RIGHTMOST_BUTTON_PRESSED)
cout << " | Rechte Taste gedrueckt!";
break;
}
}
while(running);
return 0;
}
|
Fehlermeldung:
|
Quellcode
|
1
2
3
|
error LNK2028: Nicht aufgelöstes Token (0A0002AA) ""extern "C" int __stdcall ShowCursor(int)" (?ShowCursor@@$$J14YGHH@Z)", auf das in Funktion ""void __cdecl showCursor(bool)" (?showCursor@@$$FYAX_N@Z)" verwiesen wird.
1>LabyrinthProject.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""extern "C" int __stdcall ShowCursor(int)" (?ShowCursor@@$$J14YGHH@Z)" in Funktion ""void __cdecl showCursor(bool)" (?showCursor@@$$FYAX_N@Z)".
fatal error LNK1120: 2 nicht aufgelöste externe Verweise.
|
In dem Forum hieß es das sich die Konsole nicht im "QuikEdit" Modus befinden darf. Kann man das irgendwo ausschalten? Oder liegt der Fehler wo anders?
Danke im Voraus