# Legato and C++ 11 support?

**URL:** <https://forum.legato.io/t/legato-and-c-11-support/2179>\
**Category:** Legato Application Framework\
**Created:** [October 6, 2016, 12:11pm UTC](https://forum.legato.io/t/legato-and-c-11-support/2179 "2016-10-06T12:11:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![karlkuhn](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@karlkuhn](https://forum.legato.io/u/karlkuhn)\
**Post date:** [October 6, 2016, 12:11pm UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/1 "2016-10-06T12:11:32Z")

</div>

Hi, does the standard legato project support C++ 11? If not how do I go about adding it? Do the build tools support all of the C++ 11 features?

Thanks,  
Karl

---

<div class="post-metadata">

**Author:** ![rio99](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@rio99](https://forum.legato.io/u/rio99)\
**Post date:** [October 7, 2016, 12:14pm UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/2 "2016-10-07T12:14:45Z")

</div>

All C++11 features are working for me (legato 16.07).  
You can enable it by editing .cdef file in your app project, just add these lines:

```
cxxflags: {
	-std=c++11
}

```

I am using C++14 and it works too.

---

<div class="post-metadata">

**Author:** ![karlkuhn](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@karlkuhn](https://forum.legato.io/u/karlkuhn)\
**Post date:** [October 10, 2016, 7:41am UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/3 "2016-10-10T07:41:02Z")

</div>

Thanks, I had found that in the manual… but it is not clear whether all C++11 features are supported? However, I think my problem relates to something else… I will dig around a bit more. Thanks for replying!

---

<div class="post-metadata">

**Author:** ![karlkuhn](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@karlkuhn](https://forum.legato.io/u/karlkuhn)\
**Post date:** [October 11, 2016, 8:12am UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/4 "2016-10-11T08:12:14Z")

</div>

Hi, that allows me to build a certain amount of C++, but not 11 features. When I check the \_\_cplusplus define its value is stil 199711L. So all new C++ features are disabled. How do I get DS to update this value so that I can develop using those values?

---

<div class="post-metadata">

**Author:** ![rio99](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@rio99](https://forum.legato.io/u/rio99)\
**Post date:** [October 11, 2016, 8:39am UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/5 "2016-10-11T08:39:51Z")

</div>

Go to your project properties.  
C/C++ General → Preprocessor Include Paths, Macros, etc.  
In “entries” tab choose “GNU C++” and choose “CDT User Settings Entries”, Push “Add…” button, choose “Preprocessor macro”  
enter name: \_\_cplusplus  
enter value: 201403L  
check “treat as built-in” box → OK  
Then rebuild your project index, everything should work fine now.

---

<div class="post-metadata">

**Author:** ![karlkuhn](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@karlkuhn](https://forum.legato.io/u/karlkuhn)\
**Post date:** [October 11, 2016, 10:08am UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/6 "2016-10-11T10:08:36Z")

</div>

Thanks, that did it!

---

<div class="post-metadata">

**Author:** ![Kalai](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/kalai/32/1135_2.png) [@Kalai](https://forum.legato.io/u/Kalai)\
**Post date:** [February 20, 2025, 6:16am UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/7 "2025-02-20T06:16:35Z")

</div>

Hi all,  
Am going to working on Legato freshly, need your preference whether to select “C” or “C++” language for coding. I know its a basic question , but still i need to know which one is best .Baz as i found many sample are in C language.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [February 20, 2025, 6:42am UTC](https://forum.legato.io/t/legato-and-c-11-support/2179/8 "2025-02-20T06:42:44Z")

</div>

yes, using C language should be the best as there is quite a lot of sample code for your reference.
