Error C867 Within Header File's For Loop using "Length" : <p>I am making a program that converts Roman numerals and converts them into a decimal value. I have a header file that keeps giving me the following error:</p>

<p><em>Error  C3867   'std::basic_string,std::allocator>::length': non-standard syntax; use '&amp;' to create a pointer to member   RomanChar</em></p>

<p>Where "RomanChar is the name of the project in Visual Studio. This error occurs in the for loop I created due to the ".length" portion. </p>

<p>I've tried looking up solutions to this problem and often the issues would involve adding parentheses to the member or to use something called <em>gcroot</em> which I have not been able to understand.</p>

<pre><code>#include &lt;iostream&gt; 
#include &lt;string&gt;
using namespace std;

class RomanClass { //Define class "RomanClass"
public:


    void setValue(int x) {
        Value = x;
    }

    int getValue() {
        return Value;
    }

    void setValue(string s) {

        for (int i = int(s.length) - 1; i &gt;= 0; i--) {

            if (s[i] == 'M' || 'm') {
                Value += 1000;
            }

            else if (s[i] == 'D' || 'd') {
                Value += 500;
            }

            else if (s[i] == 'C' || 'c') {
                Value += 100;
            }

            else if (s[i] == 'L' || 'l') {
                Value += 50;
            }

            else if (s[i] == 'X' || 'x') {
                Value += 10;
            }

            else if (s[i] == 'V' || 'v') {
                Value += 5;
            }

            else if (s[i] == 'I' || 'i') {
                Value += 1;

        }


    }

}

private:

   int Value = 0;
};
</code></pre>
