Boost logo

Boost Users :

Subject: Re: [Boost-users] query regarding parallel algorithms and error message
From: ian D Chivers (ian_at_[hidden])
Date: 2018-06-25 18:49:43


Thanks for the reply. I now get

 

$ g++ -Ofast -std=c++11 -Wl,--stack,0x100000000 ch3604.cxx

ch3604.cxx: In function ‘int main()’:

ch3604.cxx:155:16: error: ‘parallel_stable_sort’ is not a member of ‘boost::sort’

   boost::sort::parallel_stable_sort( x.begin() , x.end() );

                ^~~~~~~~~~~~~~~~~~~~

 

ian_at_DELL-7100 /cygdrive/c/document/cpp/examples

$ g++ -v

Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/lto-wrapper.exe

Target: x86_64-pc-cygwin

Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-2.x86_64/src/gcc-7.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-2.x86_64/src/gcc-7.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts

Thread model: posix

gcc version 7.3.0 (GCC)

 

 

and

 

cl /EHsc /I "C:\Program Files\boost\boost_1_67_0" -O2 /F 1000000000 ch3604.cxx

Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x64

Copyright (C) Microsoft Corporation. All rights reserved.

 

ch3604.cxx

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(132): error C2146: syntax error: missing ')' before identifier 'or'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(124): note: while compiling class template member function 'boost::sort::stable_detail::parallel_stable_sort<Iter_t,Compare>::parallel_stable_sort(Iter_t,Iter_t,Compare,uint32_t)'

        with

        [

            Iter_t=std::_Array_iterator<double,67108864>,

            Compare=Compare

        ]

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(68): note: see reference to function template instantiation 'boost::sort::stable_detail::parallel_stable_sort<Iter_t,Compare>::parallel_stable_sort(Iter_t,Iter_t,Compare,uint32_t)' being compiled

        with

        [

            Iter_t=std::_Array_iterator<double,67108864>,

            Compare=Compare

        ]

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(230): note: see reference to class template instantiation 'boost::sort::stable_detail::parallel_stable_sort<Iter_t,Compare>' being compiled

        with

        [

            Iter_t=std::_Array_iterator<double,67108864>

        ]

ch3604.cxx(155): note: see reference to function template instantiation 'void boost::sort::parallel_stable_sort<std::_Array_iterator<_Ty,67108864>>(Iter_t,Iter_t)' being compiled

        with

        [

            _Ty=double,

            Iter_t=std::_Array_iterator<double,67108864>

        ]

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(132): error C2065: 'or': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(132): error C2146: syntax error: missing ';' before identifier 'nthread'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(132): error C2059: syntax error: ')'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(135): error C2059: syntax error: ';'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(141): error C2059: syntax error: 'for'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(141): error C2143: syntax error: missing ')' before ';'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(142): error C2143: syntax error: missing ';' before '!='

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(142): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(142): error C2059: syntax error: ')'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(143): error C2059: syntax error: 'if'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(146): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(146): error C2371: 'boost::sort::stable_detail::sw': redefinition; different basic types

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(140): note: see declaration of 'boost::sort::stable_detail::sw'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(147): error C2059: syntax error: 'for'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(147): error C2143: syntax error: missing ')' before ';'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(148): error C2143: syntax error: missing ';' before '!='

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(148): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(148): error C2086: 'int boost::sort::stable_detail::it2': redefinition

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(142): note: see declaration of 'boost::sort::stable_detail::it2'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(148): error C2374: 'boost::sort::stable_detail::it1': redefinition; multiple initialization

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(142): note: see declaration of 'boost::sort::stable_detail::it1'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(148): error C2059: syntax error: ')'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(149): error C2059: syntax error: 'if'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(150): error C2143: syntax error: missing ';' before '{'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(150): error C2447: '{': missing function header (old-style formal list?)

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(158): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(158): error C2065: 'value_t': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(158): error C2065: 'nptr': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(158): error C2228: left of '.first' must have class/struct/union

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(159): error C2059: syntax error: 'if'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(164): error C2065: 'Iter_t': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(164): error C2923: 'boost::sort::common::range': 'Iter_t' is not a valid template type argument for parameter 'Iter_t'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(164): error C2065: 'range_initial': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(164): error C2228: left of '.first' must have class/struct/union

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(164): note: type is 'unknown-type'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(164): error C2065: 'nptr': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(164): error C2514: 'boost::sort::common::range': class has no constructors

C:\Program Files\boost\boost_1_67_0\boost/sort/common/range.hpp(38): note: see declaration of 'boost::sort::common::range'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): error C2065: 'Iter_t': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): error C2923: 'boost::sort::common::range': 'Iter_t' is not a valid template type argument for parameter 'Iter_t'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): error C2065: 'range_initial': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): error C2228: left of '.first' must have class/struct/union

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): note: type is 'unknown-type'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): error C2065: 'nptr': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): error C2228: left of '.last' must have class/struct/union

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): note: type is 'unknown-type'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(166): error C2514: 'boost::sort::common::range': class has no constructors

C:\Program Files\boost\boost_1_67_0\boost/sort/common/range.hpp(38): note: see declaration of 'boost::sort::common::range'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(168): error C2065: 'value_t': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(168): error C2059: syntax error: '>'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(168): error C2976: 'boost::sort::common::range': too few template arguments

C:\Program Files\boost\boost_1_67_0\boost/sort/common/range.hpp(38): note: see declaration of 'boost::sort::common::range'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(168): error C2065: 'nptr': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(168): error C2514: 'boost::sort::common::range': class has no constructors

C:\Program Files\boost\boost_1_67_0\boost/sort/common/range.hpp(38): note: see declaration of 'boost::sort::common::range'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(170): error C2059: syntax error: 'try'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(171): error C2143: syntax error: missing ';' before '{'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(171): error C2447: '{': missing function header (old-style formal list?)

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(175): error C2059: syntax error: 'catch'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(176): error C2143: syntax error: missing ';' before '{'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(176): error C2447: '{': missing function header (old-style formal list?)

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(181): error C2059: syntax error: 'try'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(182): error C2143: syntax error: missing ';' before '{'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(182): error C2447: '{': missing function header (old-style formal list?)

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(186): error C2059: syntax error: 'catch'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(187): error C2143: syntax error: missing ';' before '{'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(187): error C2447: '{': missing function header (old-style formal list?)

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(192): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(192): error C2371: 'boost::sort::stable_detail::range_buffer': redefinition; different basic types

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(168): note: see declaration of 'boost::sort::stable_detail::range_buffer'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(193): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(193): error C2065: 'comp': undeclared identifier

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(194): error C2059: syntax error: '}'

C:\Program Files\boost\boost_1_67_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(194): error C2143: syntax error: missing ';' before '}'

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\type_traits(1554): error C2143: syntax error: missing ';' before '{'

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include\type_traits(1554): error C2447: '{': missing function header (old-style formal list?)

 

I presume that if I replace the or with something belonging to an earlier standard that this may get me a bit further.

 

Any thoughts?

 

 

From: William Jagels [mailto:william_at_[hidden]]
Sent: 25 June 2018 04:11
To: boost-users_at_[hidden]
Cc: ian D Chivers
Subject: Re: [Boost-users] query regarding parallel algorithms and error message

 

Change parallel_stable_sort to boost::sort::parallel_stable_sort. The public api is entirely in the boost::sort namespace, the documentation just omits it for brevity.

Image removed by sender.ᐧ

 

On Sun, Jun 24, 2018 at 6:58 AM, ian D Chivers via Boost-users <boost-users_at_[hidden]> wrote:

I have installed boost to work with

Windows

  Microsoft Visual C++

  Cygwin g++

Linux

  openSuSe

I can compile and run test programs
On all three versions.

However I get the following error messages when trying To call one of the
routines in

https://www.boost.org/doc/libs/1_67_0/libs/sort/doc/html/sort/parallel.html

Here is the cygwin message

$ g++ ch3604.cxx
ch3604.cxx: In function 'int main()':
ch3604.cxx:155:3: error: 'parallel_stable_sort' was not declared in this
scope
   parallel_stable_sort( x.begin() , x.end() );

Here is the Microsoft message

C:\document\cpp\examples>cl /EHsc /I "C:\Program Files\boost\boost_1_67_0"
-O2 /F 1000000000 ch3604.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

ch3604.cxx

I get a similar message on openSuSe linux.

Here is the top part of the source file

#####

#include <iostream>
#include <algorithm>
#include <array>
#include <chrono>
#include <random>
#include <string>
#include <boost/sort/sort.hpp>

using namespace std;

#####

Here is a section of the main program

#####

  parallel_stable_sort( x.begin() , x.end() );

  heading = "Boost sort ";
  t = timer_01.elapsed();
  print_time(heading, t);

  cout << x[0] << " " << x[nr-1] << endl;

#####

I get similar messages when trying to use any of the serial
Or parallel routines.

The documentation says that I only need to include

#include <boost/sort/sort.hpp>

To make things available.

Any thoughts?

Ian Chivers

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
https://lists.boost.org/mailman/listinfo.cgi/boost-users

 




_WRD000.jpg

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net