'iostream'文件未找到错误发生在xcode 4.5? [英] 'iostream' file not found error occur in xcode 4.5?

查看:1472
本文介绍了'iostream'文件未找到错误发生在xcode 4.5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在练习C ++。我只是在XCode中添加c ++文件,并在其中写入一些字符串分割功能。之后,我包括C ++文件,即。我的AppDelegate文件中的.mm文件的扩展和从C ++类的.h文件调用函数。但我发现一个红线的静态错误,这是'iostream'文件未找到。我使用最新的XCode版本4.5和iOS 6.0。请参阅我的错误或xcode屏幕的屏幕截图。
>

i m practising C++. i just add c++ files in XCode and write some string splitting functionality in it. After that i include that C++ file i.e. extension of .mm file in my AppDelegate file and call function from .h file of C++ class. But i found one static error in red line which is 'iostream' file not found . I used latest XCode version 4.5 and iOS 6.0. Please see screen shot of my error or xcode screen.

我m尝试根据给定的链接信息修改我的代码,但没有成功。 :(

I m tried to modify my code as per given link information but no success. :(

我也跟着这个

also i followed this link information as well, but result is same.

感谢
iHungry

Thanks iHungry

推荐答案

目标C 具有 .m 如果你想在 Objective C 中使用 C ++ ,它应该具有 .mm 扩展,你可以在 .mm 文件中包含 C ++ 头文件,但如果你想包括 .h 文件中的 C ++ 头文件,需要检查 code>,例如

Objective C having .m extensions for its implementation files. If you want to use C++ in Objective C it should have .mm extensions. you can include C++ header files in your .mm file. But if you want to include your C++ header files in your .h file, you need to check macro for that, like

#ifdef __cplus
#include <iostream>
#endif

但是,我没有尝试过任何函数,包括 C ++ 头文件在 .h 文件。希望它有帮助。

But, I haven't tried any functions by including C++ header file in .h file. Hope it helps.

这篇关于'iostream'文件未找到错误发生在xcode 4.5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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