query regarding parallel algorithms and error message
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
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. ᐧ On Sun, Jun 24, 2018 at 6:58 AM, ian D Chivers via Boost-users < boost-users@lists.boost.org> 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
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
To make things available.
Any thoughts?
Ian Chivers
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
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@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
AMDG On 06/25/2018 12:49 PM, ian D Chivers via Boost-users wrote:
$ 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() ); ^~~~~~~~~~~~~~~~~~~~
Are you sure that you're not missing a #include?
It works for me.
#include
<snip> gcc version 7.3.0 (GCC) <snip> Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x64 <snip>
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'
<snip>
I presume that if I replace the or with something belonging to an earlier standard that this may get me a bit further.
`or` was a keyword in C++98 (See [lex.digraph]). Try compiling with /permissive- In Christ, Steven Watanabe
Thanks to Steven Watanabe /permissive- Fixed the Microsoft problem. Now compiles and runs. Ian -----Original Message----- From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Steven Watanabe via Boost-users Sent: 26 June 2018 00:57 To: ian D Chivers via Boost-users Cc: Steven Watanabe Subject: Re: [Boost-users] query regarding parallel algorithms and error message AMDG On 06/25/2018 12:49 PM, ian D Chivers via Boost-users wrote:
$ 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() ); ^~~~~~~~~~~~~~~~~~~~
Are you sure that you're not missing a #include?
It works for me.
#include
<snip> gcc version 7.3.0 (GCC) <snip> Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x64 <snip>
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'
<snip>
I presume that if I replace the or with something belonging to an earlier standard that this may get me a bit further.
`or` was a keyword in C++98 (See [lex.digraph]). Try compiling with /permissive- In Christ, Steven Watanabe _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
ian D Chivers
-
Steven Watanabe
-
William Jagels