Menu

#42 Error on FreeBSD: error: no member named 'tr1' in namespace 'std'

1.6
new
nobody
None
new
source
major
1.4.0
defect
2018-05-01
2018-04-19
Yuri
No

In file included from ../src/radixsort.cpp:46:
In file included from ../src/radixsort.h:44:
../src/tune.h:152:5: error: no member named 'tr1' in namespace 'std'
FUNCTIONAL_NAMESPACE::function<
^~~~~~~~~~~~~~~~~~~~
../src/tr1_functional.h:38:36: note: expanded from macro 'FUNCTIONAL_NAMESPACE'

define FUNCTIONAL_NAMESPACE std::tr1

                          ~~~~~^

../src/radixsort.cpp:462:5: error: no member named 'tr1' in namespace 'std'
RANDOM_NAMESPACE::mt19937 engine;
^~~~~~~~~~~~~~~~
../src/tr1_random.h:38:32: note: expanded from macro 'RANDOM_NAMESPACE'

define RANDOM_NAMESPACE std::tr1

                      ~~~~~^

../src/radixsort.cpp:668:29: error: no member named 'tr1' in namespace 'std'
using namespace FUNCTIONAL_NAMESPACE::placeholders;
^~~~~~~~~~~~~~~~~~~~

Discussion

  • Bruce Merry

    Bruce Merry - 2018-04-19

    It looks like the compiler detection isn't working for you. What compiler and version are you using? Can you also attach your config.log.

     
  • Yuri

    Yuri - 2018-04-19

    I use clang-5.0.1.

     
  • Yuri

    Yuri - 2018-04-19

    Attaching config.log

     
  • Bruce Merry

    Bruce Merry - 2018-04-19

    Ok reading on the internet it sounds like Clang has gotten rid of the std::tr1 namespace even though they still provide the <tr1 functional=""> header.

    Do you know if clang 5 supports C++11 by default (i.e., without having to pass a command-line option)? If so I can probably fix it by first detecting C++11 support.

     
  • Yuri

    Yuri - 2018-04-19

    Do you know if clang 5 supports C++11 by default (i.e., without having to pass a command-line option)? If so I can probably fix it by first detecting C++11 support.

    AFAIK, clang5 still requires the c++11 option, but clang6 supports it by default.

     
  • Yuri

    Yuri - 2018-04-19

    So, to be safe you always need to include this option.

     
  • Bruce Merry

    Bruce Merry - 2018-04-19

    That's going to make it more difficult - I'll probably need to set up a VM or something to experiment with clang 5 and also make sure I don't break anything. I haven't touched clogs for about a year, and I don't even have a Windows machine any more to test MSVC.

    If you want to just get going with clogs, you can probably just edit src/tr1_functional.h to change FUNCTIONAL_NAMESPACE from std::tr1 to std, and similarly in src/tr1_random.h.

     
  • Bruce Merry

    Bruce Merry - 2018-05-01

    Interestingly, I wasn't able to generate your exact issue with Ubuntu 18.04 and clang 5.0, with either libstdc++ or libc++. However, the libc++ build fails because the random classes got renamed when they were promoted from TR1 e.g. std::tr1::uniform_int -> std::uniform_int_distribution.

    I think I'm just going to assume that C++11 has arrived and get rid of all the TR1 detection.

     
  • Bruce Merry

    Bruce Merry - 2018-05-01

    Hi Yuri. Can you try out the c++11 branch in git and let me know if it works in your environment?