It's caused by a compiler bug. I reduced it to a small test case
(see http://issues.apache.org/jira/browse/STDCXX-936) and sent it
to Sun. It has been assigned a review ID of 1249871.
The fix is to use the quoted form of the #include directive in
limits.cpp, like so:
Index: src/limits.cpp
===================================================================
--- src/limits.cpp (revision 656806)
+++ src/limits.cpp (working copy)
@@ -22,7 +22,7 @@
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
@@ -31,12 +31,12 @@
#include <rw/_defs.h>
// define generic template and specializations
-#include <limits>
+#include "limits"
#if _MSC_VER != 1300 // working around an MSVC 7.0 bug (PR #26562)
# undef _RWSTD_LIMITS_INCLUDED
# define _RWSTD_DEFINE_EXPORTS
// define static data members of specializations
-# include <limits>
+# include "limits"
#endif // MSVC != 7.0
Giai Truong wrote:
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.