Windows - C ++ Byg fejl med kode

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg har problemer med at bygge en fil i c ++. Jeg har skrevet en stor del af koden på én gang og har nu problemer med at finde problemet, selv med hjælp fra fejlmeddelelserne. Meddelelserne siger, at jeg mangler tegn, og jeg har brug for lidt hjælp. Forhåbentlig kan dette hjælpe andre, hvis de løber ind i disse problemer.


specifikationer:
Jeg bruger CodeLite v12.0.3 som en IDE
Jeg bruger MINGW og gcc som kompilatorer.


COMPILER OUTPUT


    C:Windowssystem32cmd.exe /C C:/TDM-GCC-64/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ Test - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test'
C:/TDM-GCC-64/bin/g++.exe  -c  "C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp" -g -O0 -Wall  -o ./Debug/main.cpp.o -I. -I.
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp: In function 'int Menu()':
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp:162:1: error: expected 'while' before '}' token
 }
 ^
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp:162:1: error: expected '(' before '}' token
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp:162:1: error: expected primary-expression before '}' token
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp:162:1: error: expected ')' before '}' token
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp:162:1: error: expected ';' before '}' token
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp:164:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp: In function 'int Login()':
C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test/main.cpp:56:165: warning: control reaches end of non-void function [-Wreturn-type]
  if(user == "quisenberryjakob"){if(pass == "Jakob9302"){system("CLS");}else{cout<<"INVALID."; Sleep(1000); return 0;}}else{cout<<"INVALID."; Sleep(1000); return 0;}}
                                                                                                                                                                     ^
mingw32-make.exe[1]: *** [Debug/main.cpp.o] Error 1
Test.mk:97: recipe for target 'Debug/main.cpp.o' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Jakob Quisenberry/Documents/Jakob's Workspace/Test'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====1 errors, 2 warnings====


KILDE KODE


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

using namespace std;

void Loader()
    {int timingvar = 0;

        do{cout<<"Initializing and Preparing Assets";
                Sleep(200);
            cout<< ".";
                Sleep(200);
            cout<< ".";
                Sleep(200);
            cout<< ".";
                Sleep(200);

            system("CLS");

            timingvar++;

            }while(timingvar<=5);}



int Login()
{
    string user;
    string pass;


    cout<< "Assets Initialized. Content Restricted. Provide Credentials.

Username: ";
        cin>> user;
    cout<< "
Password: ";
        cin>> pass;

    system("CLS");

    int timingvar = 0;

        do{cout<<"Testing Credentials";
                Sleep(200);
            cout<< ".";
                Sleep(200);
            cout<< ".";
                Sleep(200);
            cout<< ".";
                Sleep(200);

            system("CLS");

            timingvar++;

            }while(timingvar<=5);

    if(user == "quisenberryjakob"){if(pass == "Jakob9302"){system("CLS");}else{cout<<"INVALID."; Sleep(1000); return 0;}}else{cout<<"INVALID."; Sleep(1000); return 0;}}

int Menu()
{    int menuselect;
     bool loggedin = true;
     bool systemactive = true;
     bool controlsonline = true;
     bool connectivity = true;
     bool firewallup = true;
     string loggedinrep;
     string systemactiverep;
     string controlsonlinerep;
     string connectivityrep;
     string firewalluprep;
     string statuschange;


    system("CLS");
    cout<< "Login Successful            IntellIQ V0.0.1

";
    cout<< "1. Status

[>]";
        cin>> menuselect;

        if(loggedin==1){loggedinrep = "True";}
        if(loggedin==0){loggedinrep = "False";}
        if(systemactive==1){systemactiverep = "True";}
        if(systemactive==0){systemactiverep = "False";}
        if(controlsonline==1){controlsonlinerep = "True";}
        if(controlsonline==0){controlsonlinerep = "False";}
        if(connectivity==1){connectivityrep = "True";}
        if(connectivity==0){connectivityrep = "False";}
        if(firewallup==1){firewalluprep = "True";}
        if(firewallup==0){firewalluprep = "False";}

    switch (menuselect)
    {
        case 1:
        int editmenurep;
    do{ string statmenu;
        string editmenu;


            system("CLS");
        cout<< "STATUS MENU - CENTRAL CONSOLE";

        cout<< "

1. LOG UP - "<< loggedinrep;
        cout<< "
2. SYSTEM ACTIVE - "<< systemactiverep;
        cout<< "
3. CONTROLS ONLINE - "<< controlsonlinerep;
        cout<< "
4. CONNECTIVITY AVAILABLE - "<< connectivityrep;
        cout<< "
5. FIREWALL ONLINE - "<< firewalluprep;

        cout<< "

[E]dit Status [R]eturn to Menu

[>] ";
            cin>> statmenu;

        if(statmenu == "E"){
            cout<< "

ENTER STATUS NUMBER, THEN STATUS CODE [T] [F]

[>]";
            cin>>statuschange;

            if(statuschange == "1t"){loggedinrep = "True";}else{if(statuschange == "1T"){loggedinrep =  "True";}}
            if(statuschange == "2t"){systemactiverep = "True";}else{if(statuschange == "2T"){systemactiverep =  "True";}}
            if(statuschange == "3t"){controlsonlinerep = "True";}else{if(statuschange == "3T"){controlsonlinerep =  "True";}}
            if(statuschange == "4t"){connectivityrep = "True";}else{if(statuschange == "4T"){connectivityrep =  "True";}}
            if(statuschange == "5t"){firewalluprep = "True";}else{if(statuschange == "5T"){firewalluprep =  "True";}}

            if(statuschange == "1f"){loggedinrep = "False";}else{if(statuschange == "1F"){loggedinrep =  "False";}}
            if(statuschange == "2f"){systemactiverep = "False";}else{if(statuschange == "2F"){systemactiverep =  "False";}}
            if(statuschange == "3f"){controlsonlinerep = "False";}else{if(statuschange == "3F"){controlsonlinerep =  "False";}}
            if(statuschange == "4f"){connectivityrep = "False";}else{if(statuschange == "4F"){connectivityrep =  "False";}}
            if(statuschange == "5f"){firewalluprep = "False";}else{if(statuschange == "5F"){firewalluprep =  "False";}}


            }else{if(statmenu == "e"){
            cout<< "

ENTER STATUS NUMBER, THEN STATUS CODE [T] [F]

[>]";
            cin>>statuschange;

            if(statuschange == "1t"){loggedinrep = "True";}else{if(statuschange == "1T"){loggedinrep =  "True";}}
            if(statuschange == "2t"){systemactiverep = "True";}else{if(statuschange == "2T"){systemactiverep =  "True";}}
            if(statuschange == "3t"){controlsonlinerep = "True";}else{if(statuschange == "3T"){controlsonlinerep =  "True";}}
            if(statuschange == "4t"){connectivityrep = "True";}else{if(statuschange == "4T"){connectivityrep =  "True";}}
            if(statuschange == "5t"){firewalluprep = "True";}else{if(statuschange == "5T"){firewalluprep =  "True";}}

            if(statuschange == "1f"){loggedinrep = "False";}else{if(statuschange == "1F"){loggedinrep =  "False";}}
            if(statuschange == "2f"){systemactiverep = "False";}else{if(statuschange == "2F"){systemactiverep =  "False";}}
            if(statuschange == "3f"){controlsonlinerep = "False";}else{if(statuschange == "3F"){controlsonlinerep =  "False";}}
            if(statuschange == "4f"){connectivityrep = "False";}else{if(statuschange == "4F"){connectivityrep =  "False";}}
            if(statuschange == "5f"){firewalluprep = "False";}else{if(statuschange == "5F"){firewalluprep =  "False";}}

            if(statmenu == "R"){Menu();}else{if(statmenu == "r"){Menu();}}

            cout<<"

[E]dit More Codes        [R]eturn to Menu

[>] ";
                cin>> editmenu;

            if(editmenu == "R"){editmenurep = 0;}
            if(editmenu == "r"){editmenurep = 0;}
            if(editmenu == "E"){editmenurep = 1;}
            if(editmenu == "e"){editmenurep = 1;}

        }while(editmenurep == 1);

            Menu();

            break;
        }


    }

}

}




 int main()
{
    Loader();
    Login();
    Menu();

    return 0;
}


Enhver hjælp ville blive værdsat. Tak på forhånd.

Bedste reference


Ret venligst din runde, mens den ikke har en tilstand (tilstand) i slutningen på linje 160.