我在用c ++构建文件时遇到了问题。我一次输入了很大一部分代码,即使在错误消息的帮助下,查找问题也遇到了问题。消息说我缺少字符,我需要一些帮助。希望这可以帮助其他遇到这些问题的人。
规格: 我正在使用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====
源代码
#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;
}
任何人和所有帮助将不胜感激。预先感谢。
答案 0 :(得分:0)
请修复您的do-while循环,该循环在第160行的末尾没有while(condition)。