如何编译c ++在xCode为您的iPhone应用程序? [英] How to compile c++ in xCode for your IPhone app?

查看:107
本文介绍了如何编译c ++在xCode为您的iPhone应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做IPhone开发的第一步。我想使用一些c \c ++代码,但我找不到任何参考如何做(将非常affric,如果你也可以引用我的源,当你给一个answear)

I am doing my first steps in IPhone developing. I want to use some c\c++ code but I can't find any reference of how it's done (will very appriciate if you can also refer me to your source when you give an answear)

我有一个名为calc.h的文件,包含一个简单的add和mult函数的calculator类,我使用Objective-C头文件导入它。现在我想做什么?

I have a file called calc.h containing a "calculator" class with simple add and mult functions, I imported it exactly as I did with an Objective-C header file. What am I suppose to do now?

推荐答案

无论你在C / C ++编程时做什么。

Whatever you were doing when you were coding just in C/C++.

例如:

#include "calc.h"
....
-(void) testCode { //obj-c
 float x = 3;
 float y = 8.0;
 float sumOfTwo = sum(x, y);
}

假设你的头文件中有一个名为sum的函数

Assuming that you have a function named sum in your header file similar with the one used above.

这篇关于如何编译c ++在xCode为您的iPhone应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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