Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 7 months ago.
C++11 in exported projects
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.
1 Answer
6 years, 7 months ago.
You can do so using a build profile. Add -std=gnu++11
to your local build profile then export via:
mbed export -m LPC4088 -i mcuxpresso --profile=./path/to/local/profile.json
By default, the exported project includes debug and release build configurations. Can I give multiple build profiles to mbed export
to have it create multiple build configs in the output project file(s)?
Also, I'm running mbed-cli v1.2.2. mbed export -h
gives no indication of a --profile
option. Is it missing from the help text?
$ mbed export -h usage: mbed export [-h] [-i IDE] [-m TARGET] [--source SOURCE] [-c] [-S [{matrix,ides}]] [--app-config APP_CONFIG] [-v] [-vv] Generate IDE project files for the current program. optional arguments: -h, --help show this help message and exit -i IDE, --ide IDE IDE to create project files for. Example: UVISION4, UVISION5, GCC_ARM, IAR, COIDE -m TARGET, --target TARGET Export for target MCU. Example: K64F, NUCLEO_F401RE, NRF51822... --source SOURCE Source directory. Default: . (current dir) -c, --clean Clean the build directory before compiling -S [{matrix,ides}], --supported [{matrix,ides}] Shows supported matrix of targets and toolchains --app-config APP_CONFIG Path of an app configuration file (Default is to look for 'mbed_app.json') -v, --verbose Verbose diagnostic output -vv, --very_verbose Very verbose diagnostic output
Not sure how it works exactly for LPCXpresso. Are you sure DEBUG and RELEASE actually create different builds? You can only export one profile at a time, and yes, apparently the docs are missing. Default profile is debug. How I do it for Makefiles is that I export with different profiles and just rename Makefile to Makefile-debug / Makefile-release, and go from there. But no experience with Xpresso.
Probably you can also configure the IDE to build with Mbed CLI by setting the build command. Then you can just include the --profile
switch in the build command, and call a different one when creating a release build.
Quote:
You can only export one profile at a time
I posted an issue here: https://github.com/ARMmbed/mbed-cli/issues/588
Thanks.
posted by 20 Dec 2017