Fehler bitte helfen!



  • Hi bekomme seit neuestem immer diesen LNK2019 und 1120 Fehler beim Kompilieren!

    Hier meine source:

    #include <iostream>
    #include <Windows.h>

    using namespace std;

    HANDLE handle;

    bool quit = false;
    bool first = false;

    int playerPosX = 30;
    int playerPosY = 10;
    int foregroundLayer[22][80];

    int backgroundLayer[22][80] =
    {
    { 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3 },
    { 6,8,9,9,9,12,12,12,12,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6 },
    { 6,8,9,9,9,12,12,12,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6 },
    { 6,8,9,9,9,12,12,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,0,0,7,0,0,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6 },
    { 6,8,9,9,9,12,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,0,0,7,0,0,0,0,0,0,0,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6 },
    { 6,8,9,9,9,12,12,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,6 },
    { 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,6 },
    { 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,12,12,6 },
    { 6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,12,12,12,6 },
    { 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5 }
    };

    int foregroundLayer[22][80];

    bool IsColliding(int y, int x)
    {


    return false;

    return true;
    }

    void DrawAscii(int c, int x, int y, WORD color)
    {
    COORD coord = {x,y};

    SetConsoleCursorPosition (handle, coord);
    SetConsoleTextAttribute (handle, color);

    cout << (char)c;
    }

    void Initialize(short height, short width, wchar_t* title)
    {
    handle = GetStdHandle(STD_OUTPUT_HANDLE);

    HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
    SMALL_RECT size;
    COORD b_size;

    size.Left = 0;
    size.Top = 0;
    size.Right = width;
    size.Bottom = height;
    b_size.X = width+1;
    b_size.Y = height+1;

    SetConsoleWindowInfo(hCon, true, &size);
    SetConsoleScreenBufferSize(hCon, b_size);
    SetConsoleTitle(title);

    for(int zeile = 0; zeile < 22; zeile++)
    {
    for(int spalte = 0; spalte < 80; spalte++)
    {
    foregroundLayer[zeile][spalte] = 0;
    }
    }
    foregroundLayer[playerPosY][playerPosX] = 10;
    }

    void Update()
    {
    if(GetAsyncKeyState(VK_ESCAPE))
    quit = true;

    if(GetAsyncKeyState(VK_RIGHT))
    {
    if(!IsColliding(playerPosY, playerPosX + 1))
    {
    foregroundLayer[playerPosY][playerPosX] = 11;
    playerPosX += 1;
    foregroundLayer[playerPosY][playerPosX] = 10;
    }
    }

    if(GetAsyncKeyState(VK_LEFT))
    {
    if(!IsColliding(playerPosY, playerPosX - 1))
    {
    foregroundLayer[playerPosY][playerPosX] = 11;
    playerPosX -= 1;
    foregroundLayer[playerPosY][playerPosX] = 10;
    }
    }

    if(GetAsyncKeyState(VK_UP))
    {
    if(!IsColliding(playerPosY - 1, playerPosX))
    {
    foregroundLayer[playerPosY][playerPosX] = 11;
    playerPosY -= 1;
    foregroundLayer[playerPosY][playerPosX] = 10;
    }
    }

    if(GetAsyncKeyState(VK_DOWN))
    {
    if(!IsColliding(playerPosY + 1, playerPosX))
    {
    foregroundLayer[playerPosY][playerPosX] = 11;
    playerPosY += 1;
    foregroundLayer[playerPosY][playerPosX] = 10;
    }
    }
    }

    void Render()
    {
    for(int zeile = 0; zeile < 22; zeile++)
    {
    for(int spalte = 0; spalte < 80; spalte++)
    {
    int wert = backgroundLayer[zeile][spalte];

    if(wert == 1)
    DrawAscii(205, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    if(wert == 2)
    DrawAscii(201, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    if(wert == 3)
    DrawAscii(187, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    if(wert == 4)
    DrawAscii(200, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    if(wert == 5)
    DrawAscii(188, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    if(wert == 6)
    DrawAscii(186, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    if(wert == 7)
    DrawAscii(5, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
    if(wert == 😎
    DrawAscii(6, spalte, zeile, FOREGROUND_GREEN);
    if(wert == 9)
    DrawAscii(176, spalte, zeile, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
    if(wert == 12)
    DrawAscii(30, spalte, zeile, FOREGROUND_GREEN | FOREGROUND_RED);
    }
    }
    for(int zeile = 0; zeile < 22; zeile++)
    {
    for(int spalte = 0; spalte < 80; spalte++)
    {
    int wert = foregroundLayer[zeile][spalte];

    if(wert == 10)
    {
    if(!first)
    {
    first = true;
    playerPosX = spalte;
    playerPosY = zeile;
    }
    DrawAscii(2, spalte, zeile, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
    }
    if(wert == 11)
    {
    DrawAscii(0, spalte, zeile, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
    foregroundLayer[zeile][spalte] = 0;
    }
    }
    }
    }

    void Main()
    {
    Initialize(24, 79, L"The real Legend of ASCII");

    while(!quit)
    {
    Update();

    Render();
    }
    }

    Fehler1120:1 nicht aufgelöste externe Verweise. C:\Users\*ZENSIERT*\Desktop\Lernprojekte\Spiel\Debug\Spiel.exe Spiel

    Fehler2019: Verweis auf nicht aufgelöstes externes Symbol "_main" in Funktion "___tmainCRTStartup". C:\Users\*ZENSIERT*\Desktop\Lernprojekte\Spiel\Spiel\MSVCRTD.lib(crtexe.obj) Spiel


  • Mod

    dir fehlt die funktion "main" (kleingeschrieben).



  • Oh mein Gott bin ich dämlich!
    Danke für die Antwort ich bin noch am Lernen und oh gott ey *facepalm* ich wusst nicht das die immer klein sein muss!

    1337 thx to you 😃


Anmelden zum Antworten