1

I am following this example:

http://en.cppreference.com/w/cpp/thread/sleep_for

#include <iostream>
#include <chrono>
#include <thread>

int main()
{
    std::cout << "Hello waiter" << std::endl;
    std::chrono::milliseconds dura( 2000 );
    std::this_thread::sleep_for( dura );
    std::cout << "Waited 2000 ms\n";
}

but Eclipse CDT is giving me an error (only in the intellisense, the actual code does run) on the sleep_for() line telling me:

Invalid arguments 'Candidates are:void sleep_for(const ? &)'

Do I need to tell eclipse to recognise C++11 features? It is recognising the line std::chrono::milliseconds dura( 2000 ) fine. I am using the Intel compiler v13.

user997112
  • 29,025
  • 43
  • 182
  • 361
  • Is this the same as http://stackoverflow.com/questions/4438084/stdthis-threadsleep-for-and-gcc? – Mike Vine Jun 14 '13 at 21:09
  • I don't think so- this is an Eclipse intellisense issue I think? Intel compiler must be interpreting it because the code runs. – user997112 Jun 14 '13 at 21:11
  • Ahh I missed that bit – Mike Vine Jun 14 '13 at 21:12
  • Try setting the options listed [here](http://stackoverflow.com/questions/9131763/eclipse-cdt-c11-c0x-support). You may have to modify the `-std=c++11` option to whatever equivalent ICC has. – Praetorian Jun 14 '13 at 21:15
  • @Praetorian ICC uses the same "-std=C++0x" as GCC. However the problem is that I am on Eclipse indigo and the place where I tell Eclipse intellisense to use C++ is not the same as all these suggestions... – user997112 Jun 14 '13 at 21:42

0 Answers0