tags:

views:

209

answers:

2

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!

A: 

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.

anon
I use: `g++ (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]`and boost 1.36
stefita
@stefita You might want to upgrade both GCC and Boost on your system.
anon
+3  A: 

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.

Brian R. Bondy
ups, I guess I ate the `#` as I copied the code.
stefita
gee thanks. That include did it for me!
stefita