# Build failed with JUCE\_STRING\_UTF\_TYPE=16

**URL:** <https://forum.juce.com/t/build-failed-with-juce-string-utf-type-16/16226>\
**Category:** General JUCE discussion\
**Created:** [December 18, 2015, 4:57am UTC](https://forum.juce.com/t/build-failed-with-juce-string-utf-type-16/16226 "2015-12-18T04:57:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sam/32/68_2.png) [@sam](https://forum.juce.com/u/sam)\
**Post date:** [December 18, 2015, 4:57am UTC](https://forum.juce.com/t/build-failed-with-juce-string-utf-type-16/16226/1 "2015-12-18T04:57:00Z")

</div>

Hi there,

I am on Windows with JUCE 4.1 using Visual Studio 2015. I add&nbsp;JUCE\_STRING\_UTF\_TYPE=16 to preprocessor and encountered below build error:

```
: error C2039: 'CharPointer_ASCII': is not a member of 'juce::String' (compiling source file ..\..\..\third_party\juce\modules\juce_core\juce_core.cpp)
: note: see declaration of 'juce::String' (compiling source file ..\..\..\third_party\juce\modules\juce_core\juce_core.cpp)
: note: see reference to function template instantiation 'juce::String &juce::StringHelpers::operationAddAssign<int>(juce::String &,const T)' being compiled
```

&nbsp;Can't reproduce this with JUCE 3.2 since it does not have&nbsp;StringHelpers::operationAddAssign. Thanks!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [December 18, 2015, 9:36am UTC](https://forum.juce.com/t/build-failed-with-juce-string-utf-type-16/16226/2 "2015-12-18T09:36:52Z")

</div>

Thanks, we'll check that out.

But you should think twice before&nbsp;using&nbsp;utf-16 as the native format! It's generally acknowledged as the worst of both worlds: It wastes more space than utf-8 but still doesn't have the advantages of utf-32 in being able to map indexes directly to characters.

---

<div class="post-metadata">

**Author:** ![sam](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sam/32/68_2.png) [@sam](https://forum.juce.com/u/sam)\
**Post date:** [December 21, 2015, 3:57am UTC](https://forum.juce.com/t/build-failed-with-juce-string-utf-type-16/16226/3 "2015-12-21T03:57:38Z")

</div>

Sorry, I should point out that&nbsp;JUCE\_STRING\_UTF\_TYPE=32 have same problem.

And thanks for the reminding of utf-16 usage.&nbsp;Our project should support both Mac and Windows and we are working on Windows version first. We must handle CJK strings while system locale set to English, which&nbsp;is the reason why I set&nbsp;JUCE\_STRING\_UTF\_TYPE=16 since char can't handle the CJK well when system locale not match.

VC project is set to Treat WChar\_t As Built in Type (/Zc:wchar\_t)&nbsp;that made me think&nbsp;JUCE\_STRING\_UTF\_TYPE=16 is the right choice. Now I am not so sure about this...

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [December 21, 2015, 8:11am UTC](https://forum.juce.com/t/build-failed-with-juce-string-utf-type-16/16226/4 "2015-12-21T08:11:00Z")

</div>

It sounds like you don't quite understand the purpose of that flag..

Regardless of what you set it to, the String class will have&nbsp; **exactly the same behaviour** &nbsp;and produce exactly the same results. There's nothing you can do with the UTF-32 flag set that you can't do with it set to UTF-8.&nbsp;It just packs the data&nbsp;differently internally.

The only possible reason for setting it to UTF-32 would be for optimising an application which does very heavy string manipulation that involves a lot of index look-up, and where memory size doesn't have an impact on performance. Unless you can&nbsp;measure a significant performance difference in your app when you change the flag, then don't touch it.

Personally, I'd prefer to remove these options and hard-code it to only use&nbsp;UTF8, which is&nbsp;generally agreed to be&nbsp;the best general-purpose format, and I find it hard to believe there are cases where anything else would be genuinely useful.&nbsp;But last time I threatened to do that a couple of people swore that they really did need the UTF-32 mode for performance reasons!

(BTW, I've fixed the original problem that you reported now)
