Duplicate interface declaration for class 'Foo'

John Smith picture John Smith · Oct 12, 2010 · Viewed 26.7k times · Source

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.

Answer

RohinNZ picture RohinNZ · Mar 29, 2012

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.