Ошибки сборки C ++ с кодом - PullRequest
0 голосов
/ 05 июля 2018

У меня проблемы с созданием файла в c ++. Я набрал большую часть кода сразу, и теперь у меня возникают проблемы с поиском проблемы, даже с помощью сообщений об ошибках. В сообщениях говорится, что мне не хватает символов, и мне нужно немного помочь. Надеюсь, это поможет другим, если они столкнутся с этими проблемами.

Технические характеристики: Я использую CodeLite v12.0.3 в качестве IDE Я использую MINGW и gcc в качестве компиляторов.

Выход компилятора

    C:\Windows\system32\cmd.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====

ИСТОЧНИК КОД

    #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.\n\nUsername: ";
        cin>> user;
    cout<< "\nPassword: ";
        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\n\n";
    cout<< "1. Status\n\n[>]";
        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<< "\n\n1. LOG UP - "<< loggedinrep;
        cout<< "\n2. SYSTEM ACTIVE - "<< systemactiverep;
        cout<< "\n3. CONTROLS ONLINE - "<< controlsonlinerep;
        cout<< "\n4. CONNECTIVITY AVAILABLE - "<< connectivityrep;
        cout<< "\n5. FIREWALL ONLINE - "<< firewalluprep;

        cout<< "\n\n[E]dit Status [R]eturn to Menu\n\n[>] ";
            cin>> statmenu;

        if(statmenu == "E"){
            cout<< "\n\nENTER STATUS NUMBER, THEN STATUS CODE [T] [F]\n\n[>]";
            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<< "\n\nENTER STATUS NUMBER, THEN STATUS CODE [T] [F]\n\n[>]";
            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<<"\n\n[E]dit More Codes        [R]eturn to Menu\n\n[>] ";
                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;
}

Любая помощь будет принята с благодарностью. Заранее спасибо.

1 Ответ

0 голосов
/ 05 июля 2018

Пожалуйста, исправьте ваш цикл do-while, он не имеет while (условие) в конце строки 160.

...