Viele fehler beim Linken



  • Hy Leute ,
    Ich habe ein normales leeres Windows Fenster geschrieben. Als ich fertig war hab ich es erstellen lassen und was kam raus ?

    Schaut mal

    ------ Build started: Project: Pacman, Configuration: Debug Win32 ------
    Linking...
    pacman.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function "long __stdcall programm_windowhandler(struct HWND__ *,unsigned int,unsigned int,long)" (?programm_windowhandler@@YGJPAUHWND__@@IIJ@Z)
    pacman.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall programm_windowhandler(struct HWND__ *,unsigned int,unsigned int,long)" (?programm_windowhandler@@YGJPAUHWND__@@IIJ@Z)
    pacman.obj : error LNK2019: unresolved external symbol __imp__PostMessageW@16 referenced in function "long __stdcall programm_windowhandler(struct HWND__ *,unsigned int,unsigned int,long)" (?programm_windowhandler@@YGJPAUHWND__@@IIJ@Z)
    pacman.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function "long __stdcall programm_windowhandler(struct HWND__ *,unsigned int,unsigned int,long)" (?programm_windowhandler@@YGJPAUHWND__@@IIJ@Z)
    pacman.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
    pacman.obj : error LNK2001: unresolved external symbol __RTC_InitBase
    pacman.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__TranslateAcceleratorW@12 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__GetMessageW@16 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__PeekMessageW@20 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__GetMenu@4 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__MoveWindow@24 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__GetSystemMetrics@4 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__LoadAcceleratorsW@8 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExW@4 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol __imp__LoadIconW@8 referenced in function _WinMain@16
    pacman.obj : error LNK2019: unresolved external symbol @_RTC_CheckStackVars@8 referenced in function _WinMain@16
    LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
    C:\Dokumente und Einstellungen\3D-V\Desktop\Projekte\Pacman\Pacman\Debug\Pacman.exe : fatal error LNK1120: 22 unresolved externals
    Build log was saved at "file://c:\Dokumente und Einstellungen\3D-V\Desktop\Projekte\Pacman\Pacman\Pacman\Debug\BuildLog.htm"
    Pacman - 23 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    

    Hier kommt noch das Programm

    # include <stdio.h>
    # include <windows.h>
    # include "resource.h"
    
    //Variablen
    HINSTANCE meineInstanz;
    HWND meinFenster;
    HMENU meinMenu;
    
    LRESULT CALLBACK programm_windowhandler (HWND hWnd , UINT msg , WPARAM wParam , LPARAM lParam)
    {
    	switch(msg)
    	{
    	case WM_COMMAND :
    		switch (LOWORD (wParam))
    		{
    		case IDM_EXIT:
    			PostMessage (hWnd , WM_CLOSE , 0 , 0);
    			return 0;
    		}
    		break;
    	case WM_DESTROY:
    		PostQuitMessage (0);
    		return 0;
    	}
    	return DefWindowProc (hWnd , msg , wParam , lParam);
    }
    
    int APIENTRY WinMain (HINSTANCE hInst , HINSTANCE hPrevInst , LPSTR pCmdLine , int nCmdShow)
    {
    	MSG msg;
    	HACCEL acc;
    	WNDCLASSEX wcx;
    
    	//Die Struktur wcx(WNDCLASSEX) wird mit Informationen gefüllt.
    	wcx.cbSize = sizeof (wcx);
    	wcx.lpszClassName = TEXT ("Pacman");
    	wcx.lpfnWndProc = programm_windowhandler;
    	wcx.style = CS_VREDRAW | CS_HREDRAW;
    	wcx.hInstance = hInst;
    	wcx.hIcon = LoadIcon (hInst , MAKEINTRESOURCE (IDI_MAIN));
    	wcx.hIconSm = LoadIcon (hInst , MAKEINTRESOURCE (IDI_MAIN));
    	wcx.hCursor = LoadCursor (NULL , IDC_ARROW);
    	wcx.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
    	wcx.lpszMenuName = MAKEINTRESOURCE (IDR_MENU);
    	wcx.cbClsExtra = 0;
    	wcx.cbWndExtra = 0;
    
    	if (!RegisterClassEx ( &wcx))
    		return 0;
    
    	acc = LoadAccelerators (hInst , MAKEINTRESOURCE (IDR_ACCEL));
    
    	meinFenster = CreateWindowEx (0 , TEXT ("Pacman") ,
    					TEXT ("Pacman") ,
    					WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX ,
    					CW_USEDEFAULT , CW_USEDEFAULT ,
    					400 , 600 ,
    					NULL , NULL , hInst , NULL);
    
    	if (!meinFenster)
    		return 0;
    
    	MoveWindow (meinFenster ,
    		(GetSystemMetrics (SM_CXSCREEN) - 400 ) /2,
    		(GetSystemMetrics (SM_CYSCREEN) - 600 ) /2,
    		400 , 600 , TRUE);
    
    	ShowWindow (meinFenster , nCmdShow);
    
    	meineInstanz = hInst;
    	meinMenu = GetMenu (meinFenster);
    
    	//Main Eventloop
    	while (TRUE)
    	{
    		if (PeekMessage (&msg , NULL , 0 , 0 , PM_NOREMOVE))
    		{
    			if (GetMessage (&msg , NULL , 0 , 0) == 0)
    				return 0; // Message ist WM_QUIT
    			if (TranslateAccelerator (meinFenster , acc , &msg) == 0)
    			{
    				TranslateMessage (&msg);
    				DispatchMessage (&msg);
    			}
    		}
    		else
    		{
    			//Spiel
    		}
    	}
    }
    

    Was mache ich falsch ?
    Ich hoffe ihr könnt mit diesen Informationen etwas anfangen und freue mich auf jede Antwort.

    Noch was : Beim kompillieren gibt es keine Fehler



  • Schau mal nach, ob die nötigen Libraries mit eingebunden sind (soweit ich das überblicke, sind alle Funktionen aus der user32.lib).


Anmelden zum Antworten