0

In Visual C++ you can set the character set to Use Unicode Character Set.
Which defines UNICODE and _UNICODE.

In Eclipse CDT is there anyway to accomplish the same effect?

Josh
  • 6,046
  • 11
  • 52
  • 83

2 Answers2

2

I think : Window -> Preferences -> General -> Workspace ..

Deepak Azad
  • 7,903
  • 2
  • 34
  • 49
andrea.marangoni
  • 1,499
  • 8
  • 22
2

The _UNICODE/UNICODE macro are using by Microsoft Visual C++ compiler only. So, it is not crossplatform way to add Unicode support to your programs.
Eclipse CDT use mingw, which is Windows port of GCC.
So, you can try this: http://site.icu-project.org/, or just use Qt framework - which have rich support for internationalization, and do most of job for you.
Hope this helps.

Raxillan
  • 233
  • 2
  • 6
  • No. The macros are used by any C++ compiler when compiling ``. They're not magical in any way. – MSalters Mar 15 '12 at 10:58
  • Hm, the CRT and STL implementation must also use these macro. So, if you only include in you mingw-oriented program, you don't have Unicode. See http://www.cplusplus.com/forum/articles/16820/ – Raxillan Mar 15 '12 at 12:56
  • The STL doesn't use it (doesn't need it) as it offers `std::string` and `std::wstring`. As your link notes, if you want a `UNICODE`-dependent `tstring`, you have to define it yourself. The CRT also works without it. Furthermore, even if you don't use the macro, you can still explicitly call `MessageBoxW(L"Hello world")` to get a Unicode message box, and that works equally well with mingw. – MSalters Mar 19 '12 at 08:53
  • How would you tell the linker to use wmain? On the simplest "hello world", I have a linker error 'undefined reference to main'. I don't have have 'main' I've 'wmain'. Is that supported in g++? – Uri London Mar 19 '12 at 09:48
  • @Uri http://stackoverflow.com/questions/2438297/can-we-use-wmain-functions-with-unix-compilers-or-itll-work-only-on-windows i.e. no support for wmain in gcc. – Raxillan Mar 19 '12 at 10:17