Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Intel compiler icc cannot find #include <algorithm>

Tags:

xcode

intel

icc

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.

like image 624
Ziggy Avatar asked Feb 24 '26 23:02

Ziggy


1 Answers

I was having a really stubborn error very similar to this question but with a different solution.

Algorithm: No such file or directory

My solution:

#ifdef __cplusplus
#include <algorithm>
#endif

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 apparently algorithm 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.

like image 176
Tim R. Avatar answered Feb 27 '26 03:02

Tim R.