C++ 我的基本c+中有一个未指明的错误+;程序

C++ 我的基本c+中有一个未指明的错误+;程序,c++,compiler-errors,codelite,C++,Compiler Errors,Codelite,我的程序中有一个未指定的错误。该程序对用户使用石头剪刀。我没有改变源代码中的任何内容。但是当我运行程序时,它出现了一个未指明的错误 代码: #include <stdio.h> #include <string> #include <iostream> #include <stdlib.h> #include <windows.h> #include "math.h" #include <time.h> #include

我的程序中有一个未指定的错误。该程序对用户使用石头剪刀。我没有改变源代码中的任何内容。但是当我运行程序时,它出现了一个未指明的错误

代码:

#include <stdio.h>

#include <string>
#include <iostream>
#include <stdlib.h>
#include <windows.h>
#include "math.h"
#include <time.h>
#include <cstdlib>

void begin_game();

using namespace std;

int main(){
    SetConsoleTitle("Rock Paper Scissors");

    string enter_to_continue;


    cout<<"Welcome to rock paper scissors \n";
    cout<<"Type begin to start \n";
    cin>>enter_to_continue;

    if (enter_to_continue == "begin"){
        begin_game();
    }

    return 0;
}



//begin game function
    void begin_game(){

    cout<<"\n";

    string player_input;

    bool restarting_game = true;
    //restarting game while loop
    while(restarting_game = (true)){

        restarting_game = false;

        int seed_random = seed_random + 3;
        srand(seed_random);
        int ai_random = rand() % 3+1;

        cout<<seed_random<<endl;
        cout<<"r = rock \n";
        cout<<"p = paper \n";
        cout<<"s = scissors \n \n";

        cout<<"Type r, p, or s \n";
        cout<<"You can type exit to exit game \n \n";
        cin>>player_input;

        if(player_input == "exit"){
        restarting_game = false;
        cout<<"\n";
        exit(0);
        }
        else{
        //rock vs ai
        if(player_input == "r" && ai_random == 1){
        cout<<"The computer chose rock \n";
        cout<<"ITS A TIE RESTARTING \n \n \n";
        cout<<"\n \n \n";
        bool restarting_game = true;
        }
        else if(player_input == "r" && ai_random == 2){
        cout<<"The computer chose paper \n";
        cout<<"YOU LOST RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n";
        cout<<"\n \n \n";
        restarting_game = true;
        }
        else if(player_input == "r" && ai_random == 3){
        cout<<"The computer chose rock \n";
        cout<<"YOU WON RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n ";
        cout<<"\n \n \n";
        restarting_game = true;
        }

        //paper vs ai
        if (player_input == "p" && ai_random == 1){
        cout<<"The computer chose rock \n";
        cout<<"YOU WON RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n ";
        cout<<"\n \n \n";
        restarting_game = true;
        }
        else if (player_input == "P" && ai_random == 2){
        cout<<"The computer chose paper \n";
        cout<<"ITS A TIE RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n ";
        cout<<"\n \n \n";
        restarting_game = true;
        }
        else if (player_input == "p" && ai_random == 3){
        cout<<"The computer chose rock \n";
        cout<<"YOU LOST RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n ";
        cout<<"\n \n \n";
        restarting_game = true;
        }

        //scissor vs ai
        if (player_input == "s" && ai_random == 1){
            cout<<"The computer chose rock \n";
            cout<<"YOU LOST RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n ";
            cout<<"\n \n \n";
            restarting_game = true;
        }
        else if(player_input == "s" && ai_random == 2){
            cout<<"The computer chose paper \n";
            cout<<"YOU WON RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n ";
            cout<<"\n \n \n";
            restarting_game = true;
        }
        else if(player_input == "s" && ai_random == 3){
            cout<<"The computer chose rock \n";
            cout<<"ITS A TIE RESTARTING \n \n \n \n \n \n \n \n \n \n \n \n \n ";
            cout<<"\n \n \n";
            restarting_game = true;
        }
        }
    }
    }
C:\Windows\system32\cmd.exe /C ""C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make.exe" -j4 SHELL=cmd.exe -e -f  Makefile"
"----------Building project:[ aiprogramproject - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/lisa/Desktop/codelight c++/aiprogram/aiprogramproject'
"C:/Program Files (x86)/CodeBlocks/MinGW/bin/g++.exe" -o ./Debug/aiprogramproject @"aiprogramproject.txt" -L.
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: cannot open output file ./Debug/aiprogramproject.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/aiprogramproject] Error 1
aiprogramproject.mk:78: recipe for target 'Debug/aiprogramproject' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/lisa/Desktop/codelight c++/aiprogram/aiprogramproject'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====1 errors, 0 warnings====

确保您的程序没有运行。清除,然后再试一次。

“无法打开输出文件。/Debug/aiprogramproject.exe:权限被拒绝”看起来像是一个非常指定的错误。检查程序是否未运行。while循环执行赋值
重新启动游戏=(true)
,然后“返回”true。也就是说,它不会检查
重新启动\u游戏
是否正确,它会永远循环。可能重复