stefita
stefita

Reputation: 1793

boost timer usage question

I have a really simple question, yet I can't find an answer for it. I guess I am missing something in the usage of the boost timer.hpp. Here is my code, that unfortunately gives me an error message:

#include <boost/timer.hpp>

int main() {
    boost::timer t;
}

And the error messages are as follows:

/usr/include/boost/timer.hpp: In member function ‘double boost::timer::elapsed_max() const’:
/usr/include/boost/timer.hpp:59: error: ‘numeric_limits’ is not a member of ‘std’
/usr/include/boost/timer.hpp:59: error: ‘::max’ has not been declared
/usr/include/boost/timer.hpp:59: error: expected primary-expression before ‘double’
/usr/include/boost/timer.hpp:59: error: expected `)' before ‘double’

The used library is boost 1.36 (SUSE 11.1).

Thanks in advance!

Upvotes: 3

Views: 1148

Answers (2)

Brian R. Bondy
Brian R. Bondy

Reputation: 347216

It should be fine, on a side note, are you sure you are typing #include instead of include?

You shouldn't need to, but you can try to also include:

#include <limits>

Before the boost include as it seems that may fix at least some of your problems.

Upvotes: 3

anon
anon

Reputation:

The code certainly compiles for me using g++ and Boost 1.4.2 on Windows. Can you give us the version of your g++ compiler? Use g++ --version. This looks like one of those cases where something else is defining max, possibly as a macro.

Upvotes: 0

Related Questions