关于4.1 Theos新建application错误

在几天前购买了iOS应用逆向工程这本书,开始学习,在搭建these环境就卡了一天,按照书上说的和现在的区别有点大。
而后今天在4.1部分又卡了,现在的these版本,nic.pl之后是这样的

  [1.] iphone/activator_event
  [2.] iphone/application_modern
  [3.] iphone/cydget
  [4.] iphone/flipswitch_switch
  [5.] iphone/framework
  [6.] iphone/ios7_notification_center_widget
  [7.] iphone/library
  [8.] iphone/notification_center_widget
  [9.] iphone/preference_bundle_modern
  [10.] iphone/tool
  [11.] iphone/tweak
  [12.] iphone/xpc_service

选择第二个创建application工程,而后打开iOSRETargetApp目录,发现并没有.mm后缀格式的文件,选择一个相似的RootViewController.m 进行编写代码,打开后发现有内容,清空,写入书本上的内容,完成之后make package编译打包
报错如下,求教咋处理这个,百度谷歌未果。


> Making all for application iOSRETargetApp…
==> Copying resource directories into the application wrapper…
==> Compiling XXRootViewController.m (armv7)…
XXRootViewController.m:56:1: error: unknown type name 'class'; did you mean
      'Class'?
class CPPClass
^~~~~
Class
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/include/objc/objc.h:38:28: note: 
      'Class' declared here
typedef struct objc_class *Class;
                           ^
XXRootViewController.m:56:15: error: expected ';' after top level declarator
class CPPClass
              ^
              ;
2 errors generated.
make[3]: *** [/Users/justpl/iosretargetapp/.theos/obj/debug/armv7/XXRootViewController.m.02d919b6.o] Error 1
make[2]: *** [/Users/justpl/iosretargetapp/.theos/obj/debug/armv7/iOSRETargetApp.app/iOSRETargetApp] Error 2
make[1]: *** [internal-application-all_] Error 2
make: *** [iOSRETargetApp.all.application.variables] Error 2

下面是XXRootViewController.m中的代码

> #import "XXRootViewController.h"

> @implementation XXRootViewController {
> 	NSMutableArray *_objects;
> }

> - (void)loadView {
> 	[super loadView];

> 	_objects = [[NSMutableArray alloc] init];

> 	self.title = @"Root View Controller";
> 	self.navigationItem.leftBarButtonItem = self.editButtonItem;
> 	self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonTapped:)] autorelease];
> }

> - (void)addButtonTapped:(id)sender {
> 	[_objects insertObject:[NSDate date] atIndex:0];
> 	[self.tableView insertRowsAtIndexPaths:@[ [NSIndexPath indexPathForRow:0 inSection:0] ] withRowAnimation:UITableViewRowAnimationAutomatic];
> }

> #pragma mark - Table View Data Source

> - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
> 	return 1;
> }

> - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
> 	return _objects.count;
> }

> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
> 	static NSString *CellIdentifier = @"Cell";
> 	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

> 	if (!cell) {
> 		cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
> 	}

> 	NSDate *date = _objects[indexPath.row];
> 	cell.textLabel.text = date.description;
> 	return cell;
> }

> - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
> 	[_objects removeObjectAtIndex:indexPath.row];
> 	[tableView deleteRowsAtIndexPaths:@[ indexPath ] withRowAnimation:UITableViewRowAnimationAutomatic];
> }

> #pragma mark - Table View Delegate

> - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
> 	[tableView deselectRowAtIndexPath:indexPath animated:YES];
> }

> class CPPClass . //代码都删除了。只剩下一个类的声明上面的都是自动生成的
> {
> public:
> void CPPFcuntion(const char*);
> };
> @end

我也遇到了你同样的问题,这个可能和theos的版本有关,你把XXRootViewController.m后缀改为 XXRootViewController.mm 就可以解决了;我猜测问题的原因可能是.m文件不支持C++的原因吧。