wstring/wcout in GCC under DJGPP/Cygwin

I

ing. Jan Chládek

I need compile ANSI C++ source file under Windows.
For some reasons I can't use MS Visual Studio, then I trying GCC port for
Windows.

But for this simple a.cpp:

#include <string>
#include <iostream>
using namespace std;
int main (int argc, char * argv[]) {
wstring x;
wcout<<x;
return 0;
}

I've got these error messages:

1) in DJGPP 2.03, gxx 3.4.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
a.cpp:5: error: expected `;' before "x"
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

2) in cygwin 1.5.13, g++ 3.3.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
a.cpp:5: error: parse error before `;' token
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

Do you somebody know how to compile Unicode sources until GCC for Windows?
Or exists any other free (full ANSI) C++ compiler for Windows?

Thanks
 
A

Alvin Beach

ing. Jan Chládek said:
I need compile ANSI C++ source file under Windows.
For some reasons I can't use MS Visual Studio, then I trying GCC port for
Windows.

But for this simple a.cpp:

#include <string>
#include <iostream>
using namespace std;
int main (int argc, char * argv[]) {
wstring x;
wcout<<x;
return 0;
}

I've got these error messages:

1) in DJGPP 2.03, gxx 3.4.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
a.cpp:5: error: expected `;' before "x"
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

2) in cygwin 1.5.13, g++ 3.3.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
a.cpp:5: error: parse error before `;' token
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

Do you somebody know how to compile Unicode sources until GCC for Windows?
Or exists any other free (full ANSI) C++ compiler for Windows?

Thanks

I think wstring and wcout (wide-character?) is a Windows only data type. You
need to find its real ANSI C++ standard equivalent.

Alvin
 
L

Larry I Smith

ing. Jan Chládek said:
I need compile ANSI C++ source file under Windows.
For some reasons I can't use MS Visual Studio, then I trying GCC port for
Windows.

But for this simple a.cpp:

#include <string>
#include <iostream>
using namespace std;
int main (int argc, char * argv[]) {
wstring x;
wcout<<x;
return 0;
}

I've got these error messages:

1) in DJGPP 2.03, gxx 3.4.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
a.cpp:5: error: expected `;' before "x"
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

2) in cygwin 1.5.13, g++ 3.3.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
a.cpp:5: error: parse error before `;' token
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

Do you somebody know how to compile Unicode sources until GCC for Windows?
Or exists any other free (full ANSI) C++ compiler for Windows?

Thanks

'wchar' is part of ISO C99 (7.24).
Add this line:

#include <wchar.h>

Regards,
Larry
 
I

ing. Jan Chládek

No, wide character strings and streams are part of ANSI C++

Alvin Beach said:
ing. Jan Chldek said:
I need compile ANSI C++ source file under Windows.
For some reasons I can't use MS Visual Studio, then I trying GCC port for
Windows.

But for this simple a.cpp:

#include <string>
#include <iostream>
using namespace std;
int main (int argc, char * argv[]) {
wstring x;
wcout<<x;
return 0;
}

I've got these error messages:

1) in DJGPP 2.03, gxx 3.4.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for
each
function it appears in.)
a.cpp:5: error: expected `;' before "x"
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

2) in cygwin 1.5.13, g++ 3.3.3
a.cpp: In function `int main(int, char**)':
a.cpp:5: error: `wstring' undeclared (first use this function)
a.cpp:5: error: (Each undeclared identifier is reported only once for
each
function it appears in.)
a.cpp:5: error: parse error before `;' token
a.cpp:6: error: `wcout' undeclared (first use this function)
a.cpp:6: error: `x' undeclared (first use this function)

Do you somebody know how to compile Unicode sources until GCC for
Windows?
Or exists any other free (full ANSI) C++ compiler for Windows?

Thanks

I think wstring and wcout (wide-character?) is a Windows only data type.
You
need to find its real ANSI C++ standard equivalent.

Alvin
 
M

Marcin Kaliciñski

Hi,

As far as I know some gcc ports do not support wide characters and strings.
At least gcc 3.3.3 shipped with Cygwin does not support them. This is a
_major_ deficiency and I hope somebody is working on that.

cheers,
Marcin
 
L

Larry I Smith

ing. Jan Chládek said:
No effect ... :-((

Hmm, this works for me:

// w.cpp
#include <wchar.h>
#include <string>
#include <iostream>
using namespace std;
int main (int argc, char * argv[]) {
wstring x;
wcout<<x;
return 0;
}

g++ -o w w.cpp
../w

Compiles/runs fine (linux: SuSE Pro 9.2)
GNU GCC g++ 3.3.4

Regards,
Larry
 
I

ing. Jan Chládek

Well, today I tested sample on Linux (RedHat) with g++ 3.2.3.
And - sample works fine, without include wchar.h.
It seems that error is in g++ port for Windows :-((


Larry I Smith said:
ing. Jan Chládek said:
No effect ... :-((

Hmm, this works for me:

// w.cpp
#include <wchar.h>
#include <string>
#include <iostream>
using namespace std;
int main (int argc, char * argv[]) {
wstring x;
wcout<<x;
return 0;
}

g++ -o w w.cpp
./w

Compiles/runs fine (linux: SuSE Pro 9.2)
GNU GCC g++ 3.3.4

Regards,
Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top