Subject: random_shuffle failure on B20.1?
From: "Phil Edwards" <[email-masked]>
To: "Cygwin List" <[email-masked]>
Date: Fri, 09 Apr 1999 13:34:29 -0800

I've been doing some work under B20.1/egcs-1.1.2 using
-mno-cygwin, and getting errors when I try to use the
standard algorithm random_shuffle() (which I have
used before, so I know the STL code isn't completely
full of cheese, etc).

The error messages, and an almost-minimal test case,
were saved to bug.txt; the file is attached.

When I used random_shuffle before, I had problems
because the 48-bit generator would be used instead of
the older generator; we had to call srand48() instead
of srand() before random became truly random.  But
at least it compiled then... is {,l,r}rand() not
implemented on the LoseNT end, or is the wrong cpp
macro being defined?

Much thanks as always,
Phil
(seriously missing the *nix box that just got removed)

-----== Sent via Deja News, The Discussion Network ==-----
http://www.dejanews.com/  Easy access to 50,000+ discussion forums

g++ -mno-cygwin -v -c foo.cc > bug.txt 2>&1:
Reading specs from D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/cpp.exe -lang-c++ -v -iprefix D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -Di386 -D_WIN32 -DWINNT -D_X86_=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D_WIN32 -D__WINNT__ -D_X86_=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386 -D__WINNT -Asystem(winnt) -Acpu(i386) -Amachine(i386) -D__EXCEPTIONS -remap -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__ -isystem //D/mingw/include -iwithprefixbefore ../../../../i586-cygwin32/include/mingw32 -D__MINGW32__=0.2 foo.cc C:\tmp/cc7lD86o.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../i586-cygwin32/include/mingw32
 //D/mingw/include
 D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++
 D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include
 D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../i586-cygwin32/include
 D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/include
 /cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++
 /cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include
 /cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../i586-cygwin32/include
 /cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/egcs-2.91.66/include
End of search list.
 D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/cc1plus.exe C:\tmp/cc7lD86o.ii -mno-cygwin -mno-cygwin -quiet -dumpbase foo.cc -mno-cygwin -version -o C:\tmp/ccGrzyLg.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i586-cygwin32) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h: In function `void __random_shuffle<__list_iterator<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > *>, ptrdiff_t>(struct __list_iterator<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > *>, struct __list_iterator<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > *>, ptrdiff_t *)':
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h:624:   instantiated from here
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h:613: no match for `__list_iterator<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > *> & + int'
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h:624:   instantiated from here
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h:617: no match for `__list_iterator<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > *> & - __list_iterator<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > *> &'
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h:617: `lrand48' undeclared (first use this function)
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h:617: (Each undeclared identifier is reported only once
D:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_algo.h:617: for each function it appears in.)

cat foo.cc >> bug.txt:
#include <string>
#include <list>
#include <algorithm>

using namespace std;

int main ()
{
	list<string>    s;
	s.push_back ("one");
	s.push_back ("two");
	s.push_back ("three");
	s.push_back ("four");
	random_shuffle (s.begin(), s.end());
}

--
Want to unsubscribe from this list?
Send a message to [email-masked]