c++.stlsoft - MinGW compatibility question
- "John Abney" <johnNOSPAMPLEASEabney yahoo.com> Oct 18 2003
- "Matthew Wilson" <matthew stlsoft.org> Oct 19 2003
- "John Abney" <johnNOSPAMPLEASEabney yahoo.com> Oct 19 2003
- "Matthew Wilson" <matthew stlsoft.org> Oct 19 2003
- "John Abney" <johnNOSPAMPLEASEabney yahoo.com> Oct 19 2003
- "Matthew Wilson" <matthew stlsoft.org> Oct 19 2003
- "John Abney" <johnNOSPAMPLEASEabney yahoo.com> Oct 19 2003
- "Matthew Wilson" <matthew stlsoft.org> Oct 19 2003
Hello again!
I thought I should mention that I ran into a small issue with MinGW 3.1.0
when compiling a program that used the WinSTL registry functionality. In
the included version of the standard library, std::wstring doesn't look like
it gets defined, but the compiler winds up hitting the #else half of the
"#if defined" listed below.
#ifndef _STLSOFT_STRING_ACCESS_NO_STD_STRING
#if defined(__STLSOFT_COMPILER_IS_GCC) && \
__GNUC__ < 3
typedef stlsoft_ns_qual_std(basic_string)<ss_char_w_t>
_stlsoft_wstring_t;
#else
typedef stlsoft_ns_qual_std(wstring)
_stlsoft_wstring_t;
Since std::wstring doesn't get defined for me, presumably because I'm not
using STLPort, I got a long series of errors.
In my program, I worked around this by including the following in my source
code (this is by no means a permanent fix, but I stuck it in there to get me
off the ground):
#include <string>
namespace std
{
typedef basic_string<wchar_t> wstring;
}
For the purposes of mothballing this problem, you can use
reg_key_sequence_test.cpp. Here's a version of reg_key_sequence_test.cpp
that includes the quick fix I used before.
Anyway, this problem is easy to work around, but I wanted to stick a note on
here before I forgot about it.
// This will cause various compile-time messages to be emitted. When you get
// sick of them just comment out or remove this #define
#define _STLSOFT_COMPILE_VERBOSE
#ifdef __DMC__
#define processheap_allocator _pha
#define reg_traits _rt
#define basic_reg_key _brk
#define basic_reg_key_sequence_const_iterator _brksci
#endif /* __DMC__ */
#include <winstl.h>
#include <string>
namespace std
{
typedef basic_string<wchar_t> wstring;
}
#include <winstl_reg_key_sequence.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
winstl_ns_using(ws_char_a_t)
winstl_ns_using(reg_key_a)
winstl_ns_using(reg_key_sequence_a)
static void iterate_recurse(reg_key_sequence_a::const_iterator from,
reg_key_sequence_a::const_iterator to, int depth);
struct dump_key
: public winstl_ns_qual_std(unary_function)<reg_key_a const &, void>
{
void operator ()(reg_key_a const key)
{
printf("%s\n", key.name().c_str());
}
};
int main(int /* argc */, char ** /*argv*/)
{
reg_key_sequence_a keys(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft");
printf("Iterating non-recursively (forward):\n");
winstl_ns_qual_std(for_each)(keys.begin(), keys.end(), dump_key());
#if defined(__STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT)
printf("Iterating non-recursively (backward):\n");
winstl_ns_qual_std(for_each)(keys.rbegin(), keys.rend(), dump_key());
#endif /* __STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT */
printf("Iterating recursively:\n");
iterate_recurse(keys.begin(), keys.end(), 1);
return 0;
}
void iterate_recurse(reg_key_sequence_a::const_iterator from,
reg_key_sequence_a::const_iterator to, int depth)
{
ws_char_a_t prefix[255];
memset(prefix, ' ', sizeof(prefix));
prefix[depth] = '\0';
for(; from != to; ++from)
{
const reg_key_a &key = *from;
reg_key_sequence_a keys(key);
printf("%s, %s\n", prefix, key.name().c_str());
iterate_recurse(keys.begin(), keys.end(), 1 + depth);
}
}
/*
//////////////////////////////////////////////////////////////////////////
*/
#if 0
"basic_reg_key_sequence_const_iterator<>::basic_reg_key_sequence_const_itera
tor<>(struct HKEY__ *)"
#endif /* 0 */
Oct 18 2003
I can't download anything from MinGW other than 3.2.3 (although it's listed as MinGW-3.1.0-1.exe(, Is that the one you used? If not, do you have the url you used to get the installer for your version? It's going to be pretty messy trying to maintain compatibilities, unless I can get the one you've used. "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmt55a$d4p$1 digitaldaemon.com...Hello again! I thought I should mention that I ran into a small issue with MinGW 3.1.0 when compiling a program that used the WinSTL registry functionality. In the included version of the standard library, std::wstring doesn't look
it gets defined, but the compiler winds up hitting the #else half of the "#if defined" listed below. #ifndef _STLSOFT_STRING_ACCESS_NO_STD_STRING #if defined(__STLSOFT_COMPILER_IS_GCC) && \ __GNUC__ < 3 typedef stlsoft_ns_qual_std(basic_string)<ss_char_w_t> _stlsoft_wstring_t; #else typedef stlsoft_ns_qual_std(wstring) _stlsoft_wstring_t; Since std::wstring doesn't get defined for me, presumably because I'm not using STLPort, I got a long series of errors. In my program, I worked around this by including the following in my
code (this is by no means a permanent fix, but I stuck it in there to get
off the ground): #include <string> namespace std { typedef basic_string<wchar_t> wstring; } For the purposes of mothballing this problem, you can use reg_key_sequence_test.cpp. Here's a version of reg_key_sequence_test.cpp that includes the quick fix I used before. Anyway, this problem is easy to work around, but I wanted to stick a note
here before I forgot about it. // This will cause various compile-time messages to be emitted. When you
// sick of them just comment out or remove this #define #define _STLSOFT_COMPILE_VERBOSE #ifdef __DMC__ #define processheap_allocator _pha #define reg_traits _rt #define basic_reg_key _brk #define basic_reg_key_sequence_const_iterator _brksci #endif /* __DMC__ */ #include <winstl.h> #include <string> namespace std { typedef basic_string<wchar_t> wstring; } #include <winstl_reg_key_sequence.h> #include <stdio.h> #include <algorithm> #include <functional> winstl_ns_using(ws_char_a_t) winstl_ns_using(reg_key_a) winstl_ns_using(reg_key_sequence_a) static void iterate_recurse(reg_key_sequence_a::const_iterator from, reg_key_sequence_a::const_iterator to, int depth); struct dump_key : public winstl_ns_qual_std(unary_function)<reg_key_a const &, void> { void operator ()(reg_key_a const key) { printf("%s\n", key.name().c_str()); } }; int main(int /* argc */, char ** /*argv*/) { reg_key_sequence_a keys(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft"); printf("Iterating non-recursively (forward):\n"); winstl_ns_qual_std(for_each)(keys.begin(), keys.end(), dump_key()); #if defined(__STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT) printf("Iterating non-recursively (backward):\n"); winstl_ns_qual_std(for_each)(keys.rbegin(), keys.rend(), dump_key()); #endif /* __STLSOFT_CF_BIDIRECTIONAL_ITERATOR_SUPPORT */ printf("Iterating recursively:\n"); iterate_recurse(keys.begin(), keys.end(), 1); return 0; } void iterate_recurse(reg_key_sequence_a::const_iterator from, reg_key_sequence_a::const_iterator to, int depth) { ws_char_a_t prefix[255]; memset(prefix, ' ', sizeof(prefix)); prefix[depth] = '\0'; for(; from != to; ++from) { const reg_key_a &key = *from; reg_key_sequence_a keys(key); printf("%s, %s\n", prefix, key.name().c_str()); iterate_recurse(keys.begin(), keys.end(), 1 + depth); } } /* ////////////////////////////////////////////////////////////////////////// */ #if 0
tor<>(struct HKEY__ *)" #endif /* 0 */
Oct 19 2003
I can't download anything from MinGW other than 3.2.3 (although it's
as MinGW-3.1.0-1.exe(, Is that the one you used?
indicate that I'm running MinGW-3.1.0. Is there some other way to check? Either way, that's the link that I used. Maybe MinGW and gcc run different version schemes? Let me know if there's anything else you need to know about my installation. Also, I see that MinGW is not explicitly supported by STLSoft, so there's probably no point in you worrying about this. I'd always thought that gcc and MinGW were very closely tied together, but it looks like things may not be packaged the same way.
Oct 19 2003
g++ --version Although maybe we're talking at cross purposes. It's possible that MinGW discuss a separate version to the version of GCC. Anyway, if this is the version you have, I have enough to go on, so I'll give it a bash. :) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmuk70$27df$1 digitaldaemon.com...I can't download anything from MinGW other than 3.2.3 (although it's
as MinGW-3.1.0-1.exe(, Is that the one you used?
indicate that I'm running MinGW-3.1.0. Is there some other way to check? Either way, that's the link that I used. Maybe MinGW and gcc run
version schemes? Let me know if there's anything else you need to know about my
Also, I see that MinGW is not explicitly supported by STLSoft, so there's probably no point in you worrying about this. I'd always thought that gcc and MinGW were very closely tied together, but it looks like things may
be packaged the same way.
Oct 19 2003
Yep, you've got it right - my g++ is 3.2.3, and MinGW docs claim to be 3.1.0. Apparently, it looks like MinGW might package the standard library differently than plain ol' g++ - which would be quite painful. Anyway, I realize MinGW's not officially supported, so don't bend over backwards on this one. I can easily work around this problem and note anything else that I might run into. Thanks! "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bmuq96$2f0g$1 digitaldaemon.com...g++ --version Although maybe we're talking at cross purposes. It's possible that MinGW discuss a separate version to the version of GCC. Anyway, if this is the version you have, I have enough to go on, so I'll give it a bash. :) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmuk70$27df$1 digitaldaemon.com...I can't download anything from MinGW other than 3.2.3 (although it's
as MinGW-3.1.0-1.exe(, Is that the one you used?
indicate that I'm running MinGW-3.1.0. Is there some other way to
Either way, that's the link that I used. Maybe MinGW and gcc run
version schemes? Let me know if there's anything else you need to know about my
Also, I see that MinGW is not explicitly supported by STLSoft, so
probably no point in you worrying about this. I'd always thought that
and MinGW were very closely tied together, but it looks like things may
be packaged the same way.
Oct 19 2003
Well, MinGW is my prime source of GCC, since I'm wont to boot the Linux box only when I absolutely *have* to. So in a sense it's fair to say that STLSoft does support GCC. However, if you look at the compiler compatibility tables on the site, it should just say GCC 2.95, 2.96 and 3.2. So I could weasel out by saying 3.2.3 is not supported. However, the only reason stopping me sorting this compatibility is time, as I have 10 weeks to complete the book. Hence, your may be working around with your workaround for some time ... Don't hesitate to remind me about this in a few weeks. ;) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmut6u$2ire$1 digitaldaemon.com...Yep, you've got it right - my g++ is 3.2.3, and MinGW docs claim to be 3.1.0. Apparently, it looks like MinGW might package the standard library differently than plain ol' g++ - which would be quite painful. Anyway, I realize MinGW's not officially supported, so don't bend over backwards on this one. I can easily work around this problem and note anything else that I might run into. Thanks! "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bmuq96$2f0g$1 digitaldaemon.com...g++ --version Although maybe we're talking at cross purposes. It's possible that MinGW discuss a separate version to the version of GCC. Anyway, if this is the version you have, I have enough to go on, so I'll give it a bash. :) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmuk70$27df$1 digitaldaemon.com...I can't download anything from MinGW other than 3.2.3 (although it's
as MinGW-3.1.0-1.exe(, Is that the one you used?
indicate that I'm running MinGW-3.1.0. Is there some other way to
Either way, that's the link that I used. Maybe MinGW and gcc run
version schemes? Let me know if there's anything else you need to know about my
Also, I see that MinGW is not explicitly supported by STLSoft, so
probably no point in you worrying about this. I'd always thought that
and MinGW were very closely tied together, but it looks like things
notbe packaged the same way.
Oct 19 2003
My assessment - write the book! This is no big deal at all, and I'm sure that going with STLPort would fix it in an instant. My workaround works just fine for now, and that book isn't going to write itself. :) Good luck with the writing! "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bmv03n$2mhd$1 digitaldaemon.com...Well, MinGW is my prime source of GCC, since I'm wont to boot the Linux
only when I absolutely *have* to. So in a sense it's fair to say that STLSoft does support GCC. However, if you look at the compiler
tables on the site, it should just say GCC 2.95, 2.96 and 3.2. So I could weasel out by saying 3.2.3 is not supported. However, the only reason stopping me sorting this compatibility is time, as I have 10 weeks to complete the book. Hence, your may be working around with your workaround for some time ... Don't hesitate to remind me about this in a few weeks. ;) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmut6u$2ire$1 digitaldaemon.com...Yep, you've got it right - my g++ is 3.2.3, and MinGW docs claim to be 3.1.0. Apparently, it looks like MinGW might package the standard
differently than plain ol' g++ - which would be quite painful. Anyway, I realize MinGW's not officially supported, so don't bend over backwards on this one. I can easily work around this problem and note anything else that I might run into. Thanks! "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bmuq96$2f0g$1 digitaldaemon.com...g++ --version Although maybe we're talking at cross purposes. It's possible that
discuss a separate version to the version of GCC. Anyway, if this is the version you have, I have enough to go on, so
give it a bash. :) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmuk70$27df$1 digitaldaemon.com...I can't download anything from MinGW other than 3.2.3 (although
listedas MinGW-3.1.0-1.exe(, Is that the one you used?
indicate that I'm running MinGW-3.1.0. Is there some other way to
Either way, that's the link that I used. Maybe MinGW and gcc run
version schemes? Let me know if there's anything else you need to know about my
Also, I see that MinGW is not explicitly supported by STLSoft, so
probably no point in you worrying about this. I'd always thought
gccand MinGW were very closely tied together, but it looks like things
notbe packaged the same way.
Oct 19 2003
Cheers mate. ;) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmv1e0$2o56$1 digitaldaemon.com...My assessment - write the book! This is no big deal at all, and I'm sure that going with STLPort would fix it in an instant. My workaround works just fine for now, and that book isn't going to write itself. :) Good luck with the writing! "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bmv03n$2mhd$1 digitaldaemon.com...Well, MinGW is my prime source of GCC, since I'm wont to boot the Linux
only when I absolutely *have* to. So in a sense it's fair to say that STLSoft does support GCC. However, if you look at the compiler
tables on the site, it should just say GCC 2.95, 2.96 and 3.2. So I
weasel out by saying 3.2.3 is not supported. However, the only reason stopping me sorting this compatibility is time, as I have 10 weeks to complete the book. Hence, your may be working around with your
for some time ... Don't hesitate to remind me about this in a few weeks. ;) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmut6u$2ire$1 digitaldaemon.com...Yep, you've got it right - my g++ is 3.2.3, and MinGW docs claim to be 3.1.0. Apparently, it looks like MinGW might package the standard
differently than plain ol' g++ - which would be quite painful. Anyway, I realize MinGW's not officially supported, so don't bend over backwards on this one. I can easily work around this problem and note anything else that I might run into. Thanks! "Matthew Wilson" <matthew stlsoft.org> wrote in message news:bmuq96$2f0g$1 digitaldaemon.com...g++ --version Although maybe we're talking at cross purposes. It's possible that
discuss a separate version to the version of GCC. Anyway, if this is the version you have, I have enough to go on, so
give it a bash. :) "John Abney" <johnNOSPAMPLEASEabney yahoo.com> wrote in message news:bmuk70$27df$1 digitaldaemon.com...I can't download anything from MinGW other than 3.2.3 (although
listedas MinGW-3.1.0-1.exe(, Is that the one you used?
allindicate that I'm running MinGW-3.1.0. Is there some other way to
Either way, that's the link that I used. Maybe MinGW and gcc run
version schemes? Let me know if there's anything else you need to know about my
Also, I see that MinGW is not explicitly supported by STLSoft, so
probably no point in you worrying about this. I'd always thought
gccand MinGW were very closely tied together, but it looks like
maynotbe packaged the same way.
Oct 19 2003








"Matthew Wilson" <matthew stlsoft.org>