与Objective-C函数vm_deallocate等效的Objective-C ++ [英] Objective-C++ equivalent for the Objective-C function vm_deallocate
问题描述
我有一些要转换为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屋!