繁体   English   中英

将C ++包装到Objective-C中以进行本机iOS开发

[英]Wrapping C++ into Objective-C for native iOS development

我正在尝试使用“ swig”将已经编写的C ++代码包装到Objective-C中。

这是我要遵循的解决方法: 链接

基本上,我使用swig的修改版,以便包装到Objective-C中。 但是,在安装步骤中,我收到以下错误消息;

clang: warning: argument unused during compilation: '-ansi'
Undefined symbols for architecture x86_64: "_swig_objectivec", referenced from:
modules in swigmain.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [eswig] Error 1
make[1]: *** [all] Error 2
make: *** [source] Error 2

调查错误消息后,我注意到的是,在编译Swig时未创建'Modules / obj.o'文件。
然后我修改了我的“ Makefile.in”,为obj.cxx添加了必要的行,现在swig创建了'Modules / obj.o'文件,但是这一次我收到了下面的错误消息;

make[2]: *** No rule to make target `Modules/obj.cxx', needed by
`Modules/obj.o'.  Stop.
make[1]: *** [all] Error 2
make: *** [source] Error 2

任何帮助将不胜感激。

编辑

为了获得上面列出的错误消息,我在给定的项目链接中做了一些文件更改。 所以也许我遵循的第一步是错误的,所以这是我一开始就收到的错误消息(顺便说一句,即使我同时配置了“ automake”和“ autoconf”,我也一直收到给定的错误消息);

configure.ac:15: error: possibly undefined macro: AM_INIT_AUTOMAKE 
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:33: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:35: error: possibly undefined macro: AC_COMPILE_WARNINGS
configure.ac:48: error: possibly undefined macro: AC_DEFINE
configure.ac:86: error: possibly undefined macro: AC_MSG_FAILURE
configure.ac:3041: error: possibly undefined macro: AC_DEFINE_DIR

抱歉,我无法发表评论,因此将其放在此处。 换句话说,您是说要在Objective-C应用程序中编译和使用C ++框架/代码吗? 如果是这样,我发现最简单,最可靠的方法就是仅应用文件/框架并设置项目编译器,以将语言视为Objective-C ++。 这有意义吗? 如果我想念这个问题,请告诉我:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM