U Avalos U Avalos - 1 month ago 10
C++ Question

Parse issue expected ')' C++ compile error

I don't see what's wrong with the following code. WordStore.cxx is defined similarly to have an empty function body. The compiler is complaining that "expected ')'" in the semstore.h function definition. I'm using XCode.
Incidentally, I'm upgrading some ancient (10+ year-old) code to compile on a modern C++ compiler.

/* WordStore.h */
#ifndef WORD_STORE_H
#define WORD_STORE_H
class WordStore
{
public:
WordStore();
};
#endif

// semclass.h
#ifndef SEMCLASS_H
#define SEMCLASS_H
#include <iostream>
using namespace std;
void ReadSemRules(std::istream& stream, WordStore& ws);
#endif

// semclass.cxx
#include <iostream>
#include <string.h>
#include "WordStore.h"
#include "SemClass.h"
using namespace std;
void ReadSemRules(istream& stream, WordStore& ws)
{
}

Answer

You have stray unprintable character in your program between the m and the &:

https://godbolt.org/g/gAAoGn

void ReadSemRules(std::istream& stream, WordStore& ws);
Comments