15

I have a question about the following error "Unknown type name VistaDereIzq"

I have a view called VistaDereIzq. And I do the following to add that view in this view.

#import <UIKit/UIKit.h> 
#import <MessageUI/MessageUI.h>
#import "VistaDereIzq.h"
#import "ViewController.h"

@interface VistaNavegador : UIViewController  <UIWebViewDelegate>
{ 
    VistaDereIzq *VistaIzq2;   <----- "Unknown type name VistaDereIzq"
}

@end
Haroldo Gondim
  • 7,725
  • 9
  • 43
  • 62
Fabio
  • 1,913
  • 5
  • 29
  • 53
  • 1
    That would seem to imply that `VistaDereIzq.h` somehow isn't properly declaring the class — can you show us that? – Tommy Nov 07 '12 at 23:56

1 Answers1

74

You probably have a circular dependency/include. Use a forward declaration (@class MONClass;) rather than #importing the header. Since there is no physical dependence, you should be using a forward declaration in the first place (i.e. for much faster builds).

So instead of:

#import "VistaDereIzq.h"

use:

@class VistaDereIzq;

and then add your #import to an .m file as needed.

justin
  • 104,054
  • 14
  • 179
  • 226
  • Yes Indeed, "You probably have a circular dependency/include" Removed the offending other #include. Thanks! –  Jul 15 '16 at 02:22