그래서 내 viewController.h 및 .mm에서 일부 app +++ 개체를 내 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++ faux pas를 고쳐 주셔서 감사합니다! –