Close. I'm not trying to build with mbed compile. I want to export to a project that will build with C++11. I'm currently exporting to NXP MCUXpresso, which uses arm-none-eabi-gcc. Later I plan to export to Visual Studio Code, still using arm-none-eabi-gcc.
I am working with Visual Studio Code and it doesn't matter if you are building with mbed compile or a makefile both are using arm-none-eabi-gcc compiler if you set it up.
If you compile with
mbed compile command with custom profile
mbed compile -m [your board] -t GCC_ARM --profile ./release.json
than you have to change the lines in your custom profile as I mentioned in my first post.
I don't know what the exporter generates for "IAR" but if you have a Makefile search for the following line at the "# Tools and Flags" section:
mbed compile command with custom profile
CPP = 'arm-none-eabi-g++' '-std=gnu++98' ...
and change it to:
mbed compile command with custom profile
CPP = 'arm-none-eabi-g++' '-std=gnu++11' ...
I don't think this profile feature for exports exists.
I copied mbed-os/tools/profiles/release.json to the root of my project folder, and changed "-std=gnu++98" to "-std=gnu++11" in the GCC_ARM section.
Per your suggestion, when I do mbed export profile release -i mcuxpresso, it gives an error. When I use the full filename (mbed export profile release.json -i mcuxpresso, or with the = as mbed export profile=release.json -i mcuxpresso), it completes the export, but it has no effect on the exported project settings. There are still two build configurations (build and release), and both are still set to GNU++98.
It does exists, the mbed-cli is not well documented (i.e. see https://docs.mbed.com/docs/mbed-os-handbook/en/latest/debugging/vscode/), but if you do it your way, the default (original) profile config is used.
When I am exporting a project I type:
mbed compile command with custom profile
mbed export -i vscode_gcc_arm -m EFM32PG12_STK3402 --profile release
and the project generates from the default profile, the project files/settings.
If you want to use your custom profile then you have to use the absolute or relative path to your custom profile i.e.:
mbed compile command with custom profile
mbed export -i vscode_gcc_arm -m EFM32PG12_STK3402 --profile=./release.json
or
mbed compile command with custom profile
mbed export -i vscode_gcc_arm -m EFM32PG12_STK3402 --profile=path\to\your\config\release.json
I tried it out and the exporter uses the settings from my custom profile and I don't have to touch the Makefile to build with C++11. I personally modify the Makefile anyway but for other reasons, which would blow up this post... :-)
Hope I could help you!
Previously, I asked:
Quote:
How can I use mbed-cli to set the language standard compiler option (e.g.
-std=gnu++11
) in my exported project? Is this settable via command line options? And/or via.json
files?Currently I'm using
mbed export -m LPC4088 -i mcuxpresso
.If possible, please include an explanation and a link to references, so I can learn more. Thanks.
Jan Jongboom replied:
Quote:
You can do so using a build profile. Add
-std=gnu++11
to your local build profile then export via:I think I "spoke" too soon by accepting that answer before.
When I do
mbed export -h
, there is no mention of a--profile
option. And I can't find any documentation on the web about json files formbed export
.Did Jan mix up
mbed export
withmbed build
? Is there a way to export a file with C++11 enabled in the build options? Where is it documented?