Trying to use static const members in functions qMin(), qMax(), qBound() gives a linker error:
undefined reference to `<the static constant>'.

Here is an example code:
Qt Code:
  1. class Test
  2. {
  3. public:
  4. static const float KValue=3.0;
  5. Test();
  6. };
  7.  
  8. Test::Test()
  9. {
  10. // Can be any function, not only a constructor
  11. float foo = 1.0;
  12. foo = qMax( foo, KValue );
  13. }
  14.  
  15. int main()
  16. {
  17. // somewhere in a program
  18. Test obj;
  19. }
To copy to clipboard, switch view to plain text mode 

On the other hand, when using usual local constants, qMax (and friends) works ok:

Qt Code:
  1. float foo = 1.0;
  2. const float value = KValue; // Make a copy of the static constant
  3.  
  4. foo = qMax( foo, value );
To copy to clipboard, switch view to plain text mode 

Please write, if someone knowswhy this happens or any good workarounds.

Sytem info:
Kubuntu 8.04
Qt 4.4.0 and 4.4.1
gcc 4.2.4