Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: TotalJargon on April 06, 2012, 08:25:04 pm

Title: Changing GNU GCC Compiler to use Unicode rather than ANSI
Post by: TotalJargon on April 06, 2012, 08:25:04 pm
Hello, recently I have been following some tutorials on using CodeBlocks with Direct3D and ran into a brick wall with some errors involving wchar_t arrays not wanting to convert to const CHAR* and somebody informed me that it was because my compiler was using ANSI format and the methods I was using wasn't supported by ANSI however he/she had only ever used Visual Studio/C++ and couldn't help me further

Is anyone here able to give me a good description of how I can change my project settings or compiler to use Unicode, I've tried adding:

/D "UNICODE"
/D "_UNICODE"
UNICODE
_UNICODE

in the "Other options" tab of the global compiler settings and none of these work, anyone able to point me in the right direction? :)
Thanks
Ryan
Title: Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
Post by: oBFusCATed on April 06, 2012, 08:51:35 pm
Sorry but your post is missing most of the vital information needed to answer your question.
Please re-read the forum rules very carefully and do the prerequisite for a proper post!
Title: Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
Post by: TotalJargon on April 06, 2012, 09:44:37 pm
I'm slightly confused, I've read the thread with the forum rules through a few times and cannot find anything in my thread that infringes the rules, my problem is with the IDE and not to do with programming, I've said pretty much everything there is to know about the problem I'm having (I even know what to do I just don't know how to do it in CodeBlocks), could you tell me what I've done wrong please?
Thanks
Ryan
Title: Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
Post by: stahta01 on April 06, 2012, 10:18:23 pm
I am guessing this FAQ apply; but, I not sure what info is missing.

http://wiki.codeblocks.org/index.php?title=FAQ-Issues_and_Workarounds#Q:_I_posted_on_the_forums_that_Code::Blocks_was_not_working.2C_but_no_one_could_help_me.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Issues_and_Workarounds#Q:_I_posted_on_the_forums_that_Code::Blocks_was_not_working.2C_but_no_one_could_help_me.3F)

Edit2: The info I think applies to this type of question; but, I am still not sure which piece would make a difference.
Quote
I am running Code::Blocks version Code::BlocksVersionNumber on MyOperatingSystem
(version OperatingSystemVersionNumber). The compiler I use is CompilerName
version CompilerVersionNumber.

I am looking up the normal answer; will add it to this post in a moment.

Normal answer is:

Project -> Build Options -> [select correct target on left column; if not sure select top item on list]
Tab: Compiler Settings
Sub Tab: #define
Add the define one per line without any /d or -d in front of them.

Edit3: I just figured out the issue; what you need to define changes based on the Compiler used; and makes this partly an off-topic question.
How to define it is a valid Code::Blocks question and is what I answered.

Tim S.
Title: Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
Post by: TotalJargon on April 07, 2012, 12:08:42 am
That fixed it thank you :) Now I just have to fix the crash when the compiled program runs xD
Thank you!
Ryan