error: expected unqualified-id before 'bool'

Jan 16, 2013 at 12:58pm
Hi there!
There is nothing special here, its just a code that doesn't work^^
Sorry this is a french version of the program :/
The error is at the 19th line of the .h file
So here is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <string>
#include  "Mot.h"

using namespace std;


int main()
{
    Mot motMystere;
    motMystere.modifier();

    do
    {
        motMystere.afficherTrouve();
    }
    while(motMystere.getm_gagne()=false);
    return 0;
}

.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef DEF_MOT
#define DEF_MOT

#include <string>

class Mot
{
    public:

    void modifier();
    void afficherTrouve();
    void afficherTaille();
    int getm_gagne();

    private:

    std::string m_mot;
    int m_taille;
    std::bool m_gagne = false;

};

#endif 

.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "Mot.h"
#include <iostream>

using namespace std;

void Mot::modifier()
{
    cout << "Entrez le nouveau mot a truver:" << endl;
    cin >> m_mot;
    m_taille = m_mot.size();
}

void Mot::afficherTrouve()
{
cout << "wip";

}

bool Mot::getm_gagne()
{
    return m_gagne;
}


I also have got an error: lvalue required as left operand of assignment
at the 17th line in main()...
Thank you very much for your replies!
Jan 16, 2013 at 1:03pm
The error is at the 19th line of the .h file
remove std::

I also have got an error: lvalue required as left operand of assignment
at the 17th line in main()...
replace = with ==. you sure want a comparison not an assignment
Jan 16, 2013 at 4:35pm
Thanks, ill check out asap!
Ill let you lnow if something else went wrong about that ;)
Topic archived. No new replies allowed.