'iostream'文件未找到错误发生在xcode 10

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. enter image description here

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.

Thanks iHungry

解决方案 

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

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

本文地址:IT屋 » &#39;iostream&#39; file not found error occur in xcode 4.5?

问 题 

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


 

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


 

我也跟着这个 
$ b 

感谢
iHungry 

 

解决方案

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


 

  #ifdef __cplus 
 #include< iostream> 
 #endif 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值