Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Tony_Garratt
Beginner
81 Views

Problems with gcc 3.4.6 limit template on RHE 4?

I am using Intel Fortran and C++ 11.1 update 5 on RHE 4.1 and getting a problem with the limit template (we had no such problems when compiling the same code on RHE 3 andgcc 320 and Intel 10.1). I wondered if anyone has run into this problem before and might haveany tips or suggestions please?

/usr/include/c++/3.4.6/limits(292): error #54: too few arguments in macro invocation

static _Tp max() throw() { return static_cast(0); }

^

/usr/include/c++/3.4.6/limits(292): error: expected an identifier

static _Tp max() throw() { return static_cast(0); }

0 Kudos
5 Replies
Ron_Green
Moderator
81 Views

Since this is strictly a C++ question, I'll transfer this to our C++ Forum to see if they have an answer.

ron

Tony_Garratt
Beginner
81 Views

Thanks Ron!

Judith_W_Intel
Employee
81 Views

My guess is you have a #define max(...) somewhere in your headers that you've included before limits so it's trying to expand the max identifier but there are no arguments. You could probably fix this by moving the #include of limits before the include of your header.
TimP
Black Belt
81 Views

Besides the traditional Windows

#undef max

(which seems a likely solution, given the unexpected reference to a macro)

I've had C++ apps where changing max to std::max was required, because the application got a different max from another namespace. For example, Ct has exhibited such conflicts. I'd like to see that one resolved by experts, but I guess we can't count on that.

Tony_Garratt
Beginner
81 Views

Thank you! That was it - we had re-defined max ourselves. Now you point it out, its fairly obvious :-)

I wonderhow many others have run into this - seems a bit bad that gcc defines max itself, since defining your own max is fairly common for C++ programmers.....

Thanks!

Tony

Reply