Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: pabristow on June 16, 2016, 01:15:54 pm
-
I want to use GCC and Clang in C++17 mode by adding -std=c++17.
(This is to maximise the use of constexpr).
There isn't a C++17 option in the Build Options, Compiler options, only C++14
When I add to Other compiler options and Append target options to project options, I get a compile line
g++.exe -Wall -fexceptions -g -std=c++17 -O3 -Wall -std=c++14 -II:\boost_1_61_0_b1 -c J:\Cpp\hellos\hello_boost\hello_boost.cpp -o obj\Debug\hello_boost.o
I expected the added compiler option to be last, but the default? -std=c++14 is last and so overrides and I'm not getting the option I expect.
__cplusplus=201402L
GCC 5.3.0
Is this failure to append as I, at least, expect a 'feature' or a bug?
http://forums.codeblocks.org/index.php/topic,20527.msg139644.html#msg139644
suggests that I might have to edit the options_common_warnings.xml
but this sounds a bit scary :-\
or has anyone done this already?
-
PS I know I may also need to get GCC 6 to get C++17.
But I'd like to use GCC 6 in 14 and 17 (and 11 modes)
-
Find where you set the option "-std=c++14" and remove it.
Tim S.
-
There are 3 different places:
1. target settings
2. project settings
3. global compiler settings
None of our templates set any of these options as far as I know.
-
note that the latest nightly already support on the gui : -std=c++1z because as fas as i Know c++17 does not exist yet. Who says they will make it in 2017 ...
So gcc already supports some stuff when you use -std==c++1z.
-
Correct - I had set C++14 in the global settings, but forgotten :-[
Flexibility is wonderful - except for those still in fumble mode.
But I'm still slightly surprised that "Append target option to project options" didn't seem to have the effect I expected because the global options seemed to be appended last to override both.
But it does what it says on the tin I suppose ?
It this really 'by design' as they always say on another popular site?
But thanks.