Duplicate interface declaration for class 'Foo'

Viewed 28776

I was working on my program, and it seems something in the settings changed. Suddenly I have the error "Duplicate interface declaration for class 'Foo'". It mentions a header file being duplicated but there's only one copy.

Interestingly this is only happening in debug mode, not device mode.

Does anyone have any idea what might be wrong?

I am using Objective-C++ and some static libraries.

13 Answers

I had exactly the same problem. I had two copies of the header and had deleted the old one by deleting the reference to it in Xcode. There was then only one reference of the header which pointed to the new header file in the project navigator.

After actually deleting the old header from the file system, the problem went away.

It could be a bug in Xcode. Maybe sometimes when you delete a reference to a file, part of the reference still remains in the project file.

I had this same problem building a framework. The "previous definition is here" error pointed to exactly the same header file and line number as the original "duplicate interface definition for class" error. None of the above worked, and there were no errors in the code. I did a Spotlight search for the implicated header, and two copies showed up: the one I expected, and another in build/Debug-iphonesimulator/include. I did a clean and then manually deleted the build directory. The problem went away.

Related