XCode - ml.hpp 中的 #include <map>:没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5574015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:44:58  来源:igfitidea点击:

XCode - #include <map> in ml.hpp : No such file or directory

xcodecompilationobjective-c++

提问by Oliver

I'm trying to compile a C++ code (OpenCV) and I'm going to the end. I just have a few "No such file or directory" compile error into XCode 4 on those lines :

我正在尝试编译一个 C++ 代码 (OpenCV),我要编译到最后。我在这些行上只有一些“没有这样的文件或目录”编译错误到 XCode 4 中:

#include <map>
#include <string>
#include <iostream>

What may I include to make it find the "files" ?

我可以包含哪些内容以使其找到“文件”?

I don't see.

我不明白。

I use another project based on OpenCV with Objective-C inside for example that pass the compile process with success, files are the same, and I checked all the Build settings lines one after the other, and it's all the same, except the search pathes that are updated to go to my own project folders. Folder architecture is the same...

我使用了另一个基于 OpenCV 的项目,里面有 Objective-C,例如通过编译过程成功,文件是一样的,我一个接一个地检查了所有的构建设置行,除了搜索路径之外都是一样的已更新以转到我自己的项目文件夹。文件夹架构是一样的...

I've read this linkbut it doesn't seems to be the solution as I should not have to add code anywhere of change files, since I don't use any of the code and the example project works fine like this. I've just included into one of my .m files, exactly like the example project.

我已经阅读了这个链接,但它似乎不是解决方案,因为我不应该在更改文件的任何地方添加代码,因为我没有使用任何代码,并且示例项目像这样工作正常。我刚刚包含到我的一个 .m 文件中,与示例项目完全一样。

回答by Sherm Pendley

I've just included into one of my .m files, exactly like the example project.

我刚刚包含到我的一个 .m 文件中,与示例项目完全一样。

If you want to use C++ classes, you must use Objective-C++. Your source files (not your header files, mind - the source files that #include them) must have a .mm extension.

如果要使用 C++ 类,则必须使用 Objective-C++。您的源文件(不是您的头文件,请注意 - #include 它们的源文件)必须具有 .mm 扩展名。