I have an Objective-C++ project in Xcode which compiles fine when on the normal build scheme, but when I compile for Archive, Analyze or Profile I get the compile error:
Must use ‘class’ tag to refer to type ‘Line’ in this scope
This is a very much simplified version of my code:
class Document;
class Line
{
public:
Line();
private:
friend class Document;
};
class Document
{
public:
Document();
private:
friend class Line;
};
The errors occur anywhere I try to use the type Line. Eg.
Line *l = new Line();
Do you know how to fix this error message and why it only appears when compiling in one of the schemes listed above?
I managed to fix the issue by refactoring the ‘Line’ type name into something else. The only explanation I can think of is that when performing and Archive build, Xcode compiles in some external source which defines another ‘Line’ type. Hence it needed the ‘class’ specifier to clarify the type.