Author Topic: Changing GNU GCC Compiler to use Unicode rather than ANSI  (Read 18341 times)

Offline TotalJargon

  • Single posting newcomer
  • *
  • Posts: 3
Changing GNU GCC Compiler to use Unicode rather than ANSI
« 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
« Reply #1 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!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline TotalJargon

  • Single posting newcomer
  • *
  • Posts: 3
Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
« Reply #2 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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
« Reply #3 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

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.
« Last Edit: April 07, 2012, 12:08:22 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline TotalJargon

  • Single posting newcomer
  • *
  • Posts: 3
Re: Changing GNU GCC Compiler to use Unicode rather than ANSI
« Reply #4 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