Linker Error LNK2028, LNK2019



  • Habe mir von msdn das Visual C++ 2005 Express und das Platform SDK gezogen (warte derzeit auf ein Paket von der Post mit der Vollversion). Will in die Programmierung mit der WinAPI einsteigen und dachte mir: "machste doch erstmal Schritt 1 - Hello World ausm Petzold". Tja, nun steh ich da und weiß nicht weiter.
    Source-Code und Fehlermeldung:

    #include <windows.h>
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
        PSTR szCmdLine, int iCmdShow)
    {
    	MessageBox(NULL, TEXT("Hello World!"), TEXT("MSG"), 0);
        return 0;
    }
    

    forms.obj : error LNK2028: unresolved token (0A000029) "extern "C" int __stdcall MessageBoxW(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBoxW@@$$J216YGHPAUHWND__@@PB_W1I@Z) referenced in function "extern "C" int __cdecl MessageBox(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBox@@$$J0YAHPAUHWND__@@PB_W1I@Z)

    forms.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall MessageBoxW(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBoxW@@$$J216YGHPAUHWND__@@PB_W1I@Z) referenced in function "extern "C" int __cdecl MessageBox(struct HWND__ *,wchar_t const *,wchar_t const *,unsigned int)" (?MessageBox@@$$J0YAHPAUHWND__@@PB_W1I@Z)

    *gekürzt*\Visual Studio 2005\Projects\HelloWorld\Debug\HelloWorld.exe : fatal error LNK1120: 2 unresolved externals



  • Du muss User32.lib in dein Projekt einfügen.


Anmelden zum Antworten