CodeLit 5.1 Using Unicode for Sourcecode

General questions regarding the usage of CodeLite
Casisto
CodeLite Curious
Posts: 9
Joined: Tue May 13, 2014 8:21 pm
Genuine User: Yes
IDE Question: C++
Contact:

CodeLit 5.1 Using Unicode for Sourcecode

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeLit 5.1 Using Unicode for Sourcecode

Post 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
Make sure you have read the HOW TO POST thread
Casisto
CodeLite Curious
Posts: 9
Joined: Tue May 13, 2014 8:21 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeLit 5.1 Using Unicode for Sourcecode

Post 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 "ß".
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeLit 5.1 Using Unicode for Sourcecode

Post 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
Make sure you have read the HOW TO POST thread
Casisto
CodeLite Curious
Posts: 9
Joined: Tue May 13, 2014 8:21 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CodeLit 5.1 Using Unicode for Sourcecode

Post by Casisto »

Ok, then i will try it.
Problem solved
Post Reply