I'm trying to compile some code using C++11 only syntax in JetBrains CLion, so I wish to disable C++98 mode. I followed the instructions accordance of this StackOverflow question, but am unable to get it working.
In order to achieve this goal, I went to ALT + SHIFT + F10 and passed the argument -std=c++11
in Program Arguments.
Upon building again, C++98 mode still seems to be enabled.
/cygdrive/c/Users/Zarthus/Documents/test/command.cpp: In constructor 'Command::Command(std::vector<std::basic_string<char> >)':
/cygdrive/c/Users/Zarthus/Documents/test/command.cpp:25:32: error: range-based 'for' loops are not allowed in C++98 mode
for (std::string command : commands)
^
in the code
Command::Command(std::vector<std::string> cmds)
{
for (std::string command : cmds)
{
addCommand(command);
}
}
Whilst I'm fairly certain the issue lies not within my code (IdeoneC++11 versus IdeoneC++98 (4.8.1))
Image: CLion Interface
What I'd imagine is the compilation string (per comments):
C:\cygwin64\bin\cmake.exe --build C:\Users\Zarthus\.clion10\system\cmake\generated\6dd8bed\6dd8bed\Debug --target testProject -- -j 4
So it does not appear it includes my content.
I've not a lot of experience with other JetBrains IDE's, but from what I could tell they're mostly the same.
Is anyone able to reproduce this? Should I send feedback to JetBrains that this may not be working 100% (it's still an early release build)? Or am I just botching it up and is there an user error here?
Thanks!
This has been resolved by adding add_definitions(-std=c++11)
to the end of CMakeLists.txt
instead of in ALT+SHIFT+F10's command line arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With