Download

#include<chrono> fails in Xcode

I’ve a project (UE4.5, Xcode 6.0.1) where, in a C++ file, I’ve a simple:


#include <chrono>

Building fails with this message:


 'chrono' file not found

I tried playing with the Xcode project settings, but I did’t found a solution.

answerhub: #include chrono fails in Xcode - UE4 AnswerHub ]

Check your project settings. I suspect that your project isn’t set to use C++11. #include <chrono> works fine in my UE4 project. I’m compiling with C++11, the project may not default to it.

What are you trying to accomplish? While there are times when using standard C++ libraries makes sense, there is very often a better solution provided by Epic in the engine.

The Xcode project has been generated by UE, I tried also to manually set the project variables CLANG_CXX_LANGUAGE_STANDARD and CLANG_CXX_LIBRARY (respectively to “C++11” and “libc++”) but nothing changes.

I need a timestamp for a network protocol, now I’m trying to use FPlatformTime as a work-around.

Which version of UE4, and which version of Xcode are you using? Also, did you do a clean after changing the project settings but before compiling again?

UE v4.5.0, Xcode v6.0.1, iOS SDk 8.0.

Clean & build done, I also recreated the Xcode project from scratch but nothing changed. Now it also complains with missing std::unique_ptr<> (another C++11 feature).
I agree that the project seems to be not configured for C++11, but it’s strange as UE4.5 headers uses it. Any idea?

Seems to be a problem with UBT: IOSToolChain.cs doesn’t enable C++11 under iOS ( Does iOS building support new features of C++ 11? - iOS Development - Unreal Engine Forums ).

In addition, Xcode project seems to be ignored when building; as it’s done by UBT.

Opened a bug report on AnswerHub: C++11 not enabled for iOS - UE4 AnswerHub

It seems to be ignored or not.