简体   繁体   English

C ++使用代码构建错误

[英]C++ Build Errors With Code

I am having issues building a file in c++. 我在用C ++建立文件时遇到问题。 I typed a large section of code all at once, and am now having issues finding the problem, even with help from the error messages. 我一次输入了很大一部分代码,即使在错误消息的帮助下,查找问题也遇到了问题。 The messages say I am missing characters, and I need a bit of help. 消息说我缺少字符,我需要一些帮助。 Hopefully this can help others if they run into these problems. 如果其他人遇到这些问题,希望对他们有帮助。

Specs: I am using CodeLite v12.0.3 as an IDE I am using MINGW and gcc as compilers. 规范:我使用CodeLite v12.0.3作为IDE,我使用MINGW和gcc作为编译器。

COMPILER OUTPUT 编译器输出

    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====

SOURCE CODE 源代码

    #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;
}

Any and all help would be appreciated. 任何和所有帮助将不胜感激。 Thanks in advance. 提前致谢。

请修复您的do-while循环,该循环在第160行的末尾没有while(condition)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM