Xcode Intel 编译器 icc 找不到 #include;
您好,我正在尝试使用 icc 编译器(11.1.088)在 Xcode 上编译基于 gcc 的代码 但我有以下错误:
catastrophic error: could not open source file "algorithm"
查看此文件后,它位于 gcc include 目录中,但我收到数百个错误...
有人有建议吗?
谢谢。
Hi I'm trying to compile a gcc based code on Xcode with the icc compiler (11.1.088)
but i have the following error:
catastrophic error: could not open source file "algorithm"
After looking to this file, it is located in the gcc include directory, but i get hundreds of errors...
Does anyone have suggestions ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了一个非常顽固的错误,与这个问题非常相似,但有不同的解决方案。
我的解决方案:
我在前缀头文件(例如 Xcode 在新项目中为您提供的 .pch 文件)中有
#include
,这导致它被包含在一个 Objective-C 文件,显然算法只是 C++。确保所有 Objective-C 文件都是 Objective-C++ (.mm),或者添加该指令以确保它不会包含在这些文件中。I was having a really stubborn error very similar to this question but with a different solution.
My solution:
I had the
#include
in a prefix header file (such as the .pch file Xcode gives you in a new project) which was causing it to be included in an Objective-C file, and apparentlyalgorithm
is C++ only. Either make sure all your Objective-C files are Objective-C++ (.mm) or add that directive to make sure it doesn't get included in those files.您将什么设置为基础 SDK? Xcode 是什么版本?
FWIW我刚刚尝试使用 Xcode 3.2.3 和 ICC 11.1(当然是在 OS X 10.6 下)进行测试 - 使用标准 Xcode 模板创建了一个新的 C++ 控制台应用程序,添加了
#include
到main.cc,从默认的 gcc 4.2 切换到 ICC,编译和运行时没有警告或错误。基础 SDK 是系统默认值 (10.6)。可能只是您的 Xcode 和/或 ICC 安装错误,或者您更改了项目设置(例如基本 SDK),这会导致问题。
What do you have set as your base SDK ? And what version of Xcode ?
FWIW I just tried a test with Xcode 3.2.3 and ICC 11.1 (under OS X 10.6 of course) - created a new C++ console application using the standard Xcode template, added
#include <algorithm>
to main.cc, switched from the default gcc 4.2 to ICC, and it compiles and runs without warnings or errors. The base SDK is the system default (10.6).It may just be that you have a bad installation of Xcode and/or ICC, or perhaps you have changed a project setting such as base SDK, and this is causing problems.
在开发 iOS 应用程序时,我的机器上出现了这个问题。
Xcode 版本 4.6.3 (4H1503) & iOS 版本 6.0
我使用 AppCode 进行开发,IDE 添加了(偶然)以下导入语句:
This problem occurred on my machine, while developing an iOS app.
Xcode Version 4.6.3 (4H1503) & iOS version 6.0
I'm using AppCode for development and the IDE added (by accident) the following import statement:
我也遇到了这个错误,我只是忘记将源从.m更改为.mm。所以,如果调整C++编译器不起作用,请尝试更改源文件。
I met this error too, I just forget to change the source from .m to .mm. so, if adjust C++ complier cannot work, try to change the source file.