How right set using both C++11 and C++14 new features?
-
wrote on 4 Apr 2018, 14:07 last edited by AlekseyB 4 Apr 2018, 14:11
In my pro- file I added such lines:
CONFIG += c++11 CONFIG += c++14
On the other hand, C ++ 14 is a later standard, and it is probably necessary to write only:
CONFIG += c++14
How right?
And why is it not possible to indicate support for the new features of the C++17? -
In my pro- file I added such lines:
CONFIG += c++11 CONFIG += c++14
On the other hand, C ++ 14 is a later standard, and it is probably necessary to write only:
CONFIG += c++14
How right?
And why is it not possible to indicate support for the new features of the C++17?@AlekseyB said in How right set using both C++11 and C++14 new features?:
CONFIG += c++14
is enough.
"And why is it not possible to indicate support for the new features of the C++17?" - why is it not possible? Does your compiler support C++17? -
@AlekseyB said in How right set using both C++11 and C++14 new features?:
CONFIG += c++14
is enough.
"And why is it not possible to indicate support for the new features of the C++17?" - why is it not possible? Does your compiler support C++17?wrote on 4 Apr 2018, 15:12 last edited by@jsulm said in How right set using both C++11 and C++14 new features?:
why is it not possible? Does your compiler support C++17?
Yes, I use GCC and Intel compiler: http://en.cppreference.com/w/cpp/compiler_support
In this article http://doc.qt.io/qt-5/qmake-variable-reference.html#config I'm not found option
CONFIG += c++17
-
You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS
-
You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS
wrote on 5 Apr 2018, 05:45 last edited by@Christian-Ehrlicher said in How right set using both C++11 and C++14 new features?:
You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS
Сan you write a specific line for the pro- file?
-
@Christian-Ehrlicher said in How right set using both C++11 and C++14 new features?:
You can use c++1z as option or simply add the appropriate compiler options directly to CXXFLAGS
Сan you write a specific line for the pro- file?
wrote on 5 Apr 2018, 05:51 last edited by@AlekseyB Here it is, however keep in mind C++17 support is super experimental in gcc at least. I would be careful relying on it.
QMAKE_CXXFLAGS += -std=c++1z
From the help on gcc:
c++1z The next revision of the ISO C++ standard, tentatively planned for 2017. Support is highly experimental, and will almost certainly change in incompatible ways in future releases.
-
@AlekseyB Here it is, however keep in mind C++17 support is super experimental in gcc at least. I would be careful relying on it.
QMAKE_CXXFLAGS += -std=c++1z
From the help on gcc:
c++1z The next revision of the ISO C++ standard, tentatively planned for 2017. Support is highly experimental, and will almost certainly change in incompatible ways in future releases.
wrote on 5 Apr 2018, 06:51 last edited by@ambershark said in How right set using both C++11 and C++14 new features?:
QMAKE_CXXFLAGS += -std=c++1z
Thank you!
I found that this line is also valid for the Intel compiler: https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compilerDo I need if there is a line:
QMAKE_CXXFLAGS + = -std = c ++ 1z
leave a line
CONFIG + = c ++ 14
because these settings are set in different sections?
-
@AlekseyB Here it is, however keep in mind C++17 support is super experimental in gcc at least. I would be careful relying on it.
QMAKE_CXXFLAGS += -std=c++1z
From the help on gcc:
c++1z The next revision of the ISO C++ standard, tentatively planned for 2017. Support is highly experimental, and will almost certainly change in incompatible ways in future releases.
wrote on 5 Apr 2018, 08:24 last edited byThis post is deleted! -
@ambershark said in How right set using both C++11 and C++14 new features?:
QMAKE_CXXFLAGS += -std=c++1z
Thank you!
I found that this line is also valid for the Intel compiler: https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compilerDo I need if there is a line:
QMAKE_CXXFLAGS + = -std = c ++ 1z
leave a line
CONFIG + = c ++ 14
because these settings are set in different sections?
wrote on 7 Apr 2018, 18:37 last edited by ambershark 4 Sept 2018, 06:11@AlekseyB said in How right set using both C++11 and C++14 new features?:
Do I need if there is a line:
QMAKE_CXXFLAGS + = -std = c ++ 1zleave a line
CONFIG + = c ++ 14You don't need the CONFIG line if you are using the QMAKE_CXXFLAGS line. They both do similar things. Using CONFIG will just have Qt set the proper setting for you based on which compiler you are using. The -std=c++1z is for gcc and would not work on say MSVC's compiler. So you need to be aware of that if you intend to compile for other platforms. That's the benefit of using CONFIG for your c++ setting.
Also side note, you can't use spaces like you do in
-std = c++1z
it won't work. It has to be-std=c++1z
. -
@AlekseyB said in How right set using both C++11 and C++14 new features?:
Do I need if there is a line:
QMAKE_CXXFLAGS + = -std = c ++ 1zleave a line
CONFIG + = c ++ 14You don't need the CONFIG line if you are using the QMAKE_CXXFLAGS line. They both do similar things. Using CONFIG will just have Qt set the proper setting for you based on which compiler you are using. The -std=c++1z is for gcc and would not work on say MSVC's compiler. So you need to be aware of that if you intend to compile for other platforms. That's the benefit of using CONFIG for your c++ setting.
Also side note, you can't use spaces like you do in
-std = c++1z
it won't work. It has to be-std=c++1z
.wrote on 9 Apr 2018, 05:23 last edited byThank you!
-std=c++1x
also suitable for Intel compiler. I use only these two compilers, without going over to the side of evil :)
-
Thank you!
-std=c++1x
also suitable for Intel compiler. I use only these two compilers, without going over to the side of evil :)
wrote on 9 Apr 2018, 06:11 last edited by@AlekseyB said in How right set using both C++11 and C++14 new features?:
without going over to the side of evil :)
Haha nice! Me too, I try to avoid the evil side. ;)
1/11