1
所以我想从我的viewController.h和.mm移动一些C++对象到我的appDelegate.h和.mm。问题是我得到一个预处理器问题,说明例如找不到,也不能串。我已经尝试将文件类型更改为Objective-C++头文件,但如果我尝试在viewController.h中包含#include,则仍然会出现错误,但不会出现此类错误。我怎样才能在appDelegate中导入C++?包括<iostream>在ViewController.h工作,但不在appDelegate.h
// AppDelegate.h
#import <UIKit/UIKit.h>
#include <iostream> // <-"'iostream' file not found"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
而且工作情况与的viewController:
// ViewController.h
#import <UIKit/UIKit.h>
#include <iostream>
@interface ViewController : UIViewController
@end
@newacct:感谢您解决我的C++错误! – 2013-04-22 09:36:03