Identifier not found even though it’s there?

When trying to compile in VS19 I keep getting the error of

'isReserved': identifier not found>

Im not too sure where to go because isReserved is declared as a boolean function in the exact same file.

Error Segment

ScannerForIdents aScanner(inFile);
    int nextToken;
    while((nextToken = aScanner.getIdent()) == 1) {
        lexeme = aScanner.getLastLexeme();
        if (!isReserved(lexeme)) {
            currentLineNumber = aScanner.getNumberOfLines();
            xRefTable[lexeme].insert(currentLineNumber);
        }
    }

isReserved

bool isReserved(string lexeme) {
    static const unsigned NUM_RESERVED = 74;
    static string reservedWord[NUM_RESERVED] = //Reserved Words
    //const vector<string> reservedWord
    {   
        "and", "and_eq", "asm", "auto", "bitand" // Other words that I didn't include here
    };
    for (const auto& reservedWord : reservedWord) {
        if (reservedWord == lexeme) {
            return true;    // Returns true if reservedWord matches lexeme
        }
    }
    return false;
};


Read more here: https://stackoverflow.com/questions/66995404/identifier-not-found-even-though-its-there

Content Attribution

This content was originally published by Mason Garcia at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: