iostream not found in Xcode

老子叫甜甜 提交于 2019-12-01 00:24:29

问题


I have problem including ZXing in my App. I get error: "iostream file not found". I have done everything like in ZXing instruction but i can't get this working. I'm including this in .mm file. I use story boards this project is for iOS 6.0 This is error i get:

In file included from /Users/adam/Developer/project/project/SecondViewController.mm:11: In file included from zxing/iphone/ZXingWidget/Classes/QRCodeReader.h:10: In file included from zxing/iphone/ZXingWidget/Classes/FormatReader.h:22: zxing/cpp/core/src/zxing/common/Counted.h:23:10: fatal error: 'iostream' file not found

Any idea what can i do to get this working?

EDIT:

When i select Compile Source File As Objcetive-C++ project comiples without issues, BUT as i was told this is not god soultion beacuse this can make some problems later on with other parts of app.


回答1:


Just rename your implementation file with .mm extension instead of .m solve the issue.




回答2:


Project -> Build Settings -> Apple LLVM compiler 4.1-Language -> C++ Standard Library

Make sure to set that to "libstdc++"




回答3:


Try to create a new project, and choose "command line tool" as the template for your project. Choose C++. Paste your code into the new project (it should be a .cpp file). When you run the program, it should be able to include iostream without any problems.




回答4:


placing #import "QRCodeReader.h" in the mm-file instead of it's header-file fixed the issue for me



来源:https://stackoverflow.com/questions/13857805/iostream-not-found-in-xcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!