OC和C++混编需要注意的问题
文章首发于
github.io2018-12-17 21:01:55
方案一
.c文件的identify and type右边栏修改为Objective-C sourceBuilt setting -> Apple Clang Language -> Compile Source AS设置为According to File type,即根据文件源类型来编译
方案二
- 项目中使用到C或者C++的代码部分的
.m文件,改为.mm
2.Built setting -> Apple Clang Language -> Compile Source AS设置为Objective-C++,即指定为C++的编译机制
注意
如果项目中有些头文件导入方式是用modules的@import xxxx 类似的, 那么就不能用第二种方案,因为.mm和这个会冲突,导致整个项目编译不过, 一般报错像这样 "Use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modules"
未经作者授权,禁止转载
本文来自博客园,作者:CoderWGB,转载请注明原文链接:https://www.cnblogs.com/wgb1234/p/12426027.html
THE END

浙公网安备 33010602011771号