vendredi 24 août 2018

thread is not a member of std c++

I'm having this problem where i can't use threads because i keep getting the error "'thread' is not a member of 'std'".

I am using MinGW with c++11 as a compiler flag.. On the little program i made yesterday it worked fine. Basically i want to play a "beep"-song while playing a little guessing game with pseudo random numbers.

int rnumber, guess, maxrand;

std::thread t1(pinkpanther);
t1.detach();

cout << "What do you want the maximum Number to be? ";
cin >> maxrand;

rnumber = randy(maxrand);

//Start
cout << endl << "This is a game!" << endl << "You have 5 tries to guess the random number generated by this program, have fun" << endl;

for (int i = 0; i < 5; i = i + 1)
{
    cout << "Your guess: ";
    cin >> guess;

    if (guess < rnumber)
    {
        cout << "Your guessed number is smaller than the answer! Try again!" << endl << endl;
    }
    else if (guess > rnumber)
    {
        cout << "Your guessed number is bigger than the answer! Try again!" << endl << endl;
    }
    else
    {
        cout << "you guessed the right number!";
        break;
    }
}





return 0;

it always gives me the same error ||In function 'int main()':| 'thread' is not a member of 'std'| 't1' was not declared in this scope| ||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| and i really dont know why anymore

Edit: pinkpanther() just plays the pinkpanther song i found in "beeps"




Aucun commentaire:

Enregistrer un commentaire