stdcxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Giai Truong" <Giai.Tru...@roguewave.com>
Subject Passing std::numeric_limits<> as lvalue results in undefined symbols at link time
Date Thu, 15 May 2008 22:50:07 GMT
Hello,

A customer discovered a problem with std::numeric_limits<> in stdcxx.
Passing std::numeric_limits<> as an lvalue as in the example below
results in undefined symbols for the symbol std::numeric_limits<> at
link time:
   
#include <iostream>
#include <algorithm>
#include <limits>

int main()
{ 
  int i = std::numeric_limits<double>::digits10;
  int j = std::min(std::numeric_limits<double>::digits10, 10);
//Undefined Symbols
  int j1 = std::max(std::numeric_limits<float>::min_exponent10, 2);
//Undefined Symbols
  std::cout << i << std::endl;
  std::cout << j << std::endl;
}


Undefined                       first referenced
 symbol                             in file
std::numeric_limits<double>::digits10 t.o
[Hint: static member std::numeric_limits<double>::digits10 must be
defined in the program]

ld: fatal: Symbol referencing errors. No output written to t
*** Error code 1
make: Fatal error: Command failed for target `t'

Any insight into the cause of this issue? The problem doesn't seem to
occur with native STL. The platform is Solaris/Sun Studio.

Mime
View raw message