How can I use c++11 instead of c++14


I’m using open of_v0.9.8_linuxarmv7l and wish to explicitly use c++11 instead of c++14. When I build a project I see it uses c++14

g++ -c -O3 -DNDEBUG -Wall -std=c++14 …

I tried adding -std=c++11 to my config.make:

PROJECT_CFLAGS = -std=c++11

However this seems to append the new flag at the end of the build command and now both -std=c++14 and -std=c++11 are defined:

g++ -c -O3 -DNDEBUG -Wall -std=c++14 -DGCC_HAS_REGEX … -DOF_USING_MPG123 -std=c++11

The -std=c++14 must be getting added by somewhere higher up outside of my app. How can I configure open frameworks to use c++11 globally?

1 Like

I was able to modify ./libs/openFrameworksCompiled/project/makefileCommon/ and comment out the logic there to determine the PLATFORM_CFLAGS and hard code it to PLATFORM_CFLAGS = -Wall -std=c++11. Is there a better way to do this?

no not really, we specify c++14 cause that’s already supported in gcc since some versions ago and anyway it’s backwards compatible so we haven’t taken into account that someone would need to change it to something older. we could move it to the optimization flags or to it’s own flag and allow to override from config.make. why do you need to change it?

I have a second platform I also need to build the project for whose ceiling is c++11. I need to avoid any c++14 features. It’s nice when the compiler can tell me I’ve used something not supported in c++11 on the main target (that could support it) rather than when I compile on the other platform. It helps me avoid having to go back and rework c++14 code after the fact.

yeah that makes sense, i’ll take a look when i have a moment, if you could open an issue in github that would be useful.

Thanks I’ve opened an issue here: