Can't Open chrono header file in Visual C++ 2010

Any fixes for this? Its really essential for the program I'm trying to write.
VS2010's C++11 support is spotty at best. You'll have to update and/or use a different compiler.

VS2012+ has the <chrono> header implemented.
Last edited on
According to MSDN, it was only included in the 2012 and newer versions:
http://msdn.microsoft.com/en-us/library/hh874757.aspx

you could use boost.date_time, which can do more anyway: http://www.boost.org/doc/libs/release/doc/html/date_time.html
Or #include #include <boost/chrono.hpp> , link with libboost_chrono,
and use the namespace boost::chrono instead of std::chrono

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include <chrono>
#include <boost/chrono.hpp> // link with libboost_chrono
// http://www.boost.org/doc/libs/1_54_0/doc/html/chrono.html

int main()
{
    {
        using namespace std::chrono ;

        auto start = steady_clock::now() ;

        char c ; std::cin >> c ;

        auto dur = steady_clock::now() - start ;
        std::cout << duration_cast<milliseconds>(dur).count() << " milliseconds\n" ;
    }

    {
        using namespace boost::chrono ;

        auto start = steady_clock::now() ;

        char c ; std::cin >> c ;

        auto dur = steady_clock::now() - start ;
        std::cout << duration_cast<milliseconds>(dur).count() << " milliseconds\n" ;
    }
}
Topic archived. No new replies allowed.