Thread: [Dev-C++] wstring in 4.9.7.0
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Michal M. <mol...@se...> - 2002-12-11 19:36:48
|
Hello, does anybody know how to compile programs which are using std::wstring with Dev-C++ 4.9.7.0 ? It looks like the standard C++ library is compiled without such support. Thanks in advance, Michal Molhanec |
|
From: Dave W. <orb...@ne...> - 2002-12-12 00:58:30
|
what is std::wstring? i know what std::string is but not wstring ... none of
my books seem to know either ...?
/**
* this compiles and runs using 4.9.7.0
* and the gcc 2.95 compiler
* (devcpp4970-gcc295.exe)
* NOT the v3.2 compiler
* (devcpp4970-gcc32.exe)
*/
#include <string>
#include <iostream.h>
void main (void) {
std::string fish;
fish = "fish";
cout << fish << endl;
}
----- Original Message -----
From: "Michal Molhanec" <mol...@se...>
To: <dev...@li...>
Sent: Thursday, December 12, 2002 6:36 AM
Subject: [Dev-C++] wstring in 4.9.7.0
>
> Hello,
> does anybody know how to compile programs which are using std::wstring
with
> Dev-C++ 4.9.7.0 ? It looks like the standard C++ library is compiled
> without such support.
>
> Thanks in advance,
> Michal Molhanec
|
|
From: Michal M. <mol...@se...> - 2002-12-12 01:07:14
|
On Thu, 12 Dec 2002 11:55:27 +1100 Dave Walters <orb...@ne...> wrote: > what is std::wstring? i know what std::string is but not wstring ... > none of > my books seem to know either ...? string is typedef for basic_string<char> i.e. 8 bit wide character string wstring is typedef for basic_string<wchar_t> i.e. 16 bit (unicode) wide character string |
|
From: Dave W. <orb...@ne...> - 2002-12-12 01:37:52
|
right... i found the typedef in
$devcpp/include/g++-3/string :
// Main header for the -*- C++ -*- string classes.
#ifndef __STRING__
#define __STRING__
#include <std/bastring.h>
extern "C++" {
typedef basic_string <char> string;
// typedef basic_string <wchar_t> wstring;
} // extern "C++"
#endif
btw_____this matches exactly the file on my linux box (rh
7.1)_________/usr/include/g++-3/string :)
why is it commented out?
especially when there is an entry in the stdlib.ChangeLog stating that it
has been UNcommented ...
so i uncommented it, and i tried this :
#include <string>
#include <iostream.h>
void main (void) {
std::wstring fish;
fish = (wchar_t)"fish"; //i shouldn't have to typecast this should i
cout << fish << endl;
}
and the output is "0", which makes me think i'm missing something with how
wstrings are handled in the gnu std:: templates ...?
so this is why its commented out: because there are no operators /
translators yet for wchar_t types (of course constructing a translator is
daunting for me ...)
what do you think mike? anyone?
i think the fix to this problem would make it into the next gcc release?
> On Thu, 12 Dec 2002 11:55:27 +1100 Dave Walters
<orb...@ne...> wrote:
>
> > what is std::wstring? i know what std::string is but not wstring ...
> > none of
> > my books seem to know either ...?
>
> string is typedef for basic_string<char> i.e. 8 bit wide character string
> wstring is typedef for basic_string<wchar_t> i.e. 16 bit (unicode) wide
> character string
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:
> With Great Power, Comes Great Responsibility
> Learn to use your power at OSDN's High Performance Computing Channel
> http://hpc.devchannel.org/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Michal M. <mol...@se...> - 2002-12-12 01:55:52
|
On Thu, 12 Dec 2002 12:34:54 +1100 Dave Walters
<orb...@ne...> wrote:
> right... i found the typedef in
> $devcpp/include/g++-3/string :
>
> // Main header for the -*- C++ -*- string classes.
>
> #ifndef __STRING__
> #define __STRING__
>
> #include <std/bastring.h>
>
> extern "C++" {
> typedef basic_string <char> string;
> // typedef basic_string <wchar_t> wstring;
> } // extern "C++"
>
> #endif
>
>
> btw_____this matches exactly the file on my linux box (rh
> 7.1)_________/usr/include/g++-3/string :)
>
>
> why is it commented out?
>
> especially when there is an entry in the stdlib.ChangeLog stating that it
> has been UNcommented ...
in my dev-c++ 4.9.7.0 + gcc 3.2 it's already uncommented but somebody
forget
to recompile the library with it :-(
> so i uncommented it, and i tried this :
>
> #include <string>
> #include <iostream.h>
>
> void main (void) {
> std::wstring fish;
> fish = (wchar_t)"fish"; //i shouldn't have to typecast this should i
> cout << fish << endl;
> }
>
>
> and the output is "0", which makes me think i'm missing something with
> how
> wstrings are handled in the gnu std:: templates ...?
you probably wanted to write:
fish = (wchar_t * ) "fish";
weren't you?
but it still want be correct as the correct syntax is
fish = L"fish";
and it should be written to wcout instead of cout
p.s.
it's better to
#include <iostream>
using namespace std;
instead of
#include <iostream.h>
and btw C++ standard knows only main returning int (not void)
Thanks in advance,
Michal
|
|
From: Michal M. <mol...@se...> - 2002-12-12 02:37:28
|
maybe this should be changed: // Define if code specialized for wchar_t should be used. /* #undef _GLIBCPP_USE_WCHAR_T */ ? |