This app build as long as I don’t need a particular cxxflag.
However if I add #include in myclass.h and the following in Component.cdef as explain in [url]LEGATO: Component Definition .cdef :
cxxflags:
{
-std=c++11
}
My app doesn’t build anymore and print: c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
It prints the same error if I add the cxxflags or if I remove it. It seems that the cxxflags is ignored because -std=c++11 doesn’t appear during the build.
For debugging purpose I added this flag :
cflags:
{
-std=c++11
}
And this time I could see that my flag appeared during the build but as expected I had the following error: error: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C [-Werror]
I’ve asked some questions and I’ve had it confirmed that the cxxflags stanza in the cdef file is not being processed correctly. A bug has been logged about this - and knowing the Legato team it will probably be fixed reasonably promptly (They’re good like that!).
There is a workaround though. If you’re using DS to do your development, you can edit the Application Project (the project with the adef file) Properties to add your desired cxx flags.
[ol]
[li]Right click on the app project and select properties[/li]
[li]in the right hand pane, expand C/C++ Build and select Settings[/li]
[li]In the left hand pane you’ll see some tabs - the first (Tool Settings) should be open[/li]
[li]Select the mkapp tool, and edit the command to add --cxxflags=“-std=c++11” after the command mkapp[/li]
[li]Click OK, and rebuild your Application (NOT just the Component)[/li][/ol]
I’ve tested this and confirms that it works with the include file you referenced above.
I’ve inserted an image with my modifications in case my description is a bit vague…
[attachment=0]20150822-legato-cxxflags.png[/attachment]
If you’re doing it from the command line, edit your makefile so that your mkapp line looks like so: