与Objective-C函数vm_deallocate等效的Objective-C ++ [英] Objective-C++ equivalent for the Objective-C function vm_deallocate

查看:148
本文介绍了与Objective-C函数vm_deallocate等效的Objective-C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些要转换为Objective-C ++的Objective-C代码.要将源文件的扩展名从.m更改为.mm,我将文件类型设置为Objective-C++ Source.但是,现在我的项目无法构建.它在我称为vm_deallocate的行中给出了错误.

I have some Objective-C code that I'd like to convert to Objective-C++. To changed the extension of the source files from .m to .mm, and I set the filetype as Objective-C++ Source. However, now my project fails to build. Its giving an error on lines that I call vm_deallocate.

以下是一行:

vm_deallocate(mach_task_self(), (vm_address_t)prevInfo, prevInfo);

确切的错误是:

使用未声明的标识符vm_deallocate

Use of undeclared identifier vm_deallocate

vm_deallocate是否仅限于Objective-C?有等效的Objective-C ++函数吗?

Is vm_deallocate restricted to Objective-C? Is there an equivalent Objective-C++ function?

推荐答案

否,因为它是c. 这更多是标题问题.

No, since it's c. This is more a header problem.

确保您已在正确的文件中包含

Make sure you have include in the right file

#include <mach/mach_init.h>
#include <mach/vm_map.h>

它应该编译而不会抱怨.

And it should compile without complain.

这篇关于与Objective-C函数vm_deallocate等效的Objective-C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆