ERLEDIGT
JA
JA
ANTWORTEN
13
13
ZUGRIFFE
3000
3000
EMPFEHLEN
-
Tach!
Ich bekomme sehr oft die gleichen Linker Error, wenn ich nen Quellcode compilieren will. Und zwar sagt der Compiler: [Linker Error] undefined reference to 'MoveToEx@16'
[Linker Error] undefined reference to 'LineTo@12'
Id returned 1 exit status
Ich benutze den Dev-C++ Compiler. Was hat es mit den Fehlern auf sich wenn ich die bei unterschiedlichen Projekten bekomme
Danke!
-
08.07.05 19:28 #2
- Registriert seit
- Apr 2002
- Ort
- Delmenhorst (Niedersachsen)
- Beiträge
- 3.567
moin
Das heisst das du versuchst eine der beiden Funktionen zu benutzen, jedoch findet er sie nicht.
Wahrscheinlich ist eine benötigte Libary nciht eingebunden.
Poste mal nen Quellcode bei dem der Fehler erscheint.
mfg
umbrasaxum
-
Code :
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
#include <windows.h> #include <string.h> const char *CLASSNAME = "Tutorial", *WINNAME = "Tutorial 3 - The Graphics"; HDC hdc = NULL; LRESULT CALLBACK WndProc(HWND hWnd, unsigned int iMessage, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow) { HWND hWnd; MSG Message; WNDCLASS WndClass; memset(&WndClass, 0, sizeof(WndClass)); WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW); WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hIcon = LoadIcon(hInstance, NULL); WndClass.hInstance = hInstance; WndClass.lpfnWndProc = WndProc; WndClass.lpszClassName = CLASSNAME; WndClass.style = CS_HREDRAW | CS_VREDRAW; if(!RegisterClass(&WndClass)) return 0; hWnd = CreateWindow(CLASSNAME, WINNAME, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 300, 100, NULL, NULL, hInstance, NULL); ShowWindow(hWnd, nCmdShow); while(GetMessage(&Message, hWnd, 0, 0)) { TranslateMessage(&Message); DispatchMessage(&Message); } return Message.wParam; } LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { switch(iMessage) { case WM_LBUTTONDOWN: hdc = GetDC(hWnd); if(hdc) { short xp = LOWORD(lParam); short yp = HIWORD(lParam); MoveToEx(hdc, xp, yp, NULL); } break; case WM_LBUTTONUP: if(hdc) ReleaseDC(hWnd, hdc); hdc = NULL; break; case WM_MOUSEMOVE: if(hdc) { short xp = LOWORD(lParam); short yp = HIWORD(lParam); LineTo(hdc, xp, yp); } break; case WM_CLOSE: if(MessageBox(hWnd, "Do you really want to quit?", "Message", MB_YESNO) == IDYES) { if(hdc) ReleaseDC(hWnd, hdc); PostQuitMessage(0); } break; default: return DefWindowProc(hWnd, iMessage, wParam, lParam); } return 0; }
-
08.07.05 19:34 #4
- Registriert seit
- Apr 2002
- Ort
- Delmenhorst (Niedersachsen)
- Beiträge
- 3.567
moin
Hab bei deinem Code mal die Code-Tags eingefügt.
Guckmal nach ob die Gdi32.lib eingebunden wird.
mfg
umbrasaxum
-
Was ist die Gdi32.lib und wo gucke ich nach ob sie eingefügt ist
-
08.07.05 19:39 #6
- Registriert seit
- Apr 2002
- Ort
- Delmenhorst (Niedersachsen)
- Beiträge
- 3.567
moin
Irgendwo in den Compiler oder Linker einstellungen muss stehen welche Bibliotheken includiert werden.
mfg
umbrasaxum
-
Ich hab jetzt den GUI32 Typ noch eingefügt(den hab ich in der Bibliothek so gefunden). Jetzt funktioniert das ganze. Besten Dank!
-
Ich hab hier schon wieder nen Linker Error den ich nicht weg kriege.
"undefined reference to 'Z15WindowProcedureP6HWnd__jjl@16".
Was ist da wieder faul? Ich benutze überigens den Dev C++ Compiler.
Danke
-
21.07.05 10:47 #9
- Registriert seit
- Apr 2002
- Ort
- Delmenhorst (Niedersachsen)
- Beiträge
- 3.567
moin
Ich nehme an das du irgendwo was mit der Callback Routine falsch gemacht hast.
mfg
umbrasaxum
-
OK. Hier mal mein Code:
Wenn du mir den Fehler sagen köntest wer das echt gutCode :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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
#include <windows.h> #include <stdio.h> /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "WindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HMENU hMenu; POINT point; int iAuswahl; char szText[64]; switch (message) { case WM_CREATE: hMenu = CreatePopupMenu (); // Menu anlegen // und rein mit den Einträgen.. Der 2te Parameter ist die ID des jew. Eintrages InsertMenu (hMenu, 0, MF_BYPOSITION, 0, "Menueintrag"); InsertMenu (hMenu, 1, MF_BYPOSITION, 1, "Menueintrag"); InsertMenu (hMenu, 2, MF_SEPARATOR, 0, NULL); // Separator InsertMenu (hMenu, 3, MF_BYPOSITION, 3, "Menueintrag"); return 0 ; case WM_CONTEXTMENU: // jetzt könnte ein Contextmenu angezeigt werden sollen // Koordinaten des Mauszeigers ermitteln POINTSTOPOINT (point, lParam); // Sind point.x und point.y == -1, so wurde die Nachricht // als Ergebnis auf ein Tastatur-Ereignis gesendet. if ((point.x == -1) && (point.y == -1)) { point.x = point.y = GetSystemMetrics (SM_CXEDGE); ClientToScreen (hwnd, &point); // Die Koordinaten auf unser Fenster legen } // WM_CONTEXTMENU nicht verarbeiten, wenn ein Rechtsklick // in die Titelleiste vorliegt. Hier soll schließlich das // Systemmenu angezeigt werden else if (HTCLIENT != SendMessage (hwnd, WM_NCHITTEST, 0, lParam)) { break; } // Das Menu an der Position des Mauszeigers anzeigen iAuswahl = (int) TrackPopupMenu (hMenu, TPM_CENTERALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, point.x, point.y, 0, hwnd, 0); // Ausgabe welches Item gewählt wurde sprintf (szText, "Itemnummer %d wurde ausgewählt", iAuswahl); MessageBox (NULL, szText, "Nachricht", MB_OK); return 0; case WM_DESTROY: DestroyMenu (hMenu); // Aufräumen PostQuitMessage (0); return 0; } return DefWindowProc (hwnd, message, wParam, lParam); }
-
21.07.05 12:10 #11
- Registriert seit
- Apr 2002
- Ort
- Delmenhorst (Niedersachsen)
- Beiträge
- 3.567
moin
Ja, da ist doch schon der Fehler, deine Callback Routine heisst WndProc, in der WindowsClass Struktur hast du aber angegeben das sie WindowProcedure heisst.
Und gewöhn dir bitte an Code-Tags zu benutzen.
mfg
umbrasaxum
-
Was sind Code-Tags?
-
21.07.05 12:33 #13
- Registriert seit
- Apr 2002
- Ort
- Delmenhorst (Niedersachsen)
- Beiträge
- 3.567
moin
Guckst du da: http://www.tutorials.de/misc.php?do=bbcode#code
Ist dein Problem behoben?
mfg
umbrasaxum
-
Alles klar weiss ich bescheid
Ja danke mein problem ist behoben...
Ähnliche Themen
-
Linker error
Von rojeroje im Forum C/C++Antworten: 2Letzter Beitrag: 22.09.09, 20:09 -
Linker Error
Von Sek77 im Forum C/C++Antworten: 1Letzter Beitrag: 02.04.08, 18:36 -
[c++]Linker Error
Von mcyonx im Forum C/C++Antworten: 3Letzter Beitrag: 12.01.08, 23:03 -
[Dev-C++] Linker Error, was ist zu tun?
Von meilon im Forum C/C++Antworten: 2Letzter Beitrag: 09.08.06, 11:10 -
Linker error
Von Sotares im Forum C/C++Antworten: 4Letzter Beitrag: 12.11.05, 23:25





Zitieren
Login






