Page 1 of 1

CodeLit 5.1 Using Unicode for Sourcecode

Posted: Tue May 13, 2014 8:30 pm
by Casisto
Hello there,

I have troubles to Compile my Sourcecode (with VC++ ist works).

I get the Error:
error: cannot convert 'char*' to 'LPCWSTR {aka const wchar_t*}' for argument '1' to 'void* CreateFileW(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE)'
At VC++ I had can fix this when i set:
"Project>Properties>Configurations>All Configuration>Configuration Properties>General>Character Set"
to:
"Use Multi-Byte Character Set"

How can i do this at CodeLite?
I dont found a answer at this forum, by searching with google and by searching in CodeLite for Myself.
I`m using CodeLite 5.1; Installed CodeLite with the Installer at Windows 8.1 and i`m using the g++ Compiler.

Thanks for your help
Casisto

Re: CodeLit 5.1 Using Unicode for Sourcecode

Posted: Tue May 13, 2014 9:28 pm
by eranif
This problem is not related to codelite.
You are trying to convert char* to LPCWSTR (which is of type wchar_t*)

You should change your code to something like this:

Code: Select all

CreateFile("myfile.txt",...)
to

Code: Select all

CreateFile(L"myfile.txt",...)
Google it up...

Here is an example:
http://stackoverflow.com/questions/3225 ... to-lpcwstr
Eran

Re: CodeLit 5.1 Using Unicode for Sourcecode

Posted: Tue May 13, 2014 10:28 pm
by Casisto
Hi eranif,

I know this solution, but I hope I can have the other solution like in VC++ or Geany...
At least, the programm should be OS-independently.

Is it impossible to set the "Character Set" in CodeLite to Unicode? I have try (after UTF-8 is default) ISO-8859_1, but the error ist still there...

And a other Problem i will have with ASCII, I want to use regional Characters like "Ä" or "ß".

Re: CodeLit 5.1 Using Unicode for Sourcecode

Posted: Tue May 13, 2014 10:51 pm
by eranif
Casisto wrote:but I hope I can have the other solution like in VC++ or Geany...
This is not an editor issue... but rather a code issue.
I am guessing that what VC does it undefines the '_UNICODE' from the build or something like that
so you are actually calling:
CreateFileA and _not_ CreateFileW
Casisto wrote:At least, the programm should be OS-independently.
? L"" is standard C++ its not OS specific...
http://stackoverflow.com/questions/1308 ... refix-in-c
Casisto wrote:And a other Problem i will have with ASCII, I want to use regional Characters like "Ä" or "ß"
You can do this with L"" (did not try this, but it should be doable)

Eran

Re: CodeLit 5.1 Using Unicode for Sourcecode

Posted: Tue May 13, 2014 11:11 pm
by Casisto
Ok, then i will try it.
Problem solved