I've tried all the usual suggestions. I am also using cmake_minimum_required(VERSION 3.16), am running on a Mac and have tried both G++ and CLANG.
For example:
Adding any of these to CMakeLists.txt does not work
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
As my test, I've included the code shown below in my main function and the result is always C++98
if (__cplusplus == 201703L) {
std::cout << "C++17\n";
} else if (__cplusplus == 201402L) {
std::cout << "C++14\n";
} else if (__cplusplus == 201103L) {
std::cout << "C++11\n";
} else if (__cplusplus == 199711L) {
std::cout << "C++98\n";
} else {
std::cout << "pre-standard C++\n";
}
Aucun commentaire:
Enregistrer un commentaire