'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. 

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 
#endif

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

本文地址:IT屋 » 'iostream' 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 

你可能感兴趣的:(新知识点)