In CMakelists.txt, I have:
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 14)
if(WIN32)
set(CMAKE_CXX_FLAGS "/EHsc")
else()
set(CMAKE_CXX_FLAGS -m64)
endif()
I verified that in visual studio, it is in fact running c++14, by doing these steps
I have the following flags enabled:
set(COMMON_FLAGS -Wfloat-conversion -Wsign-compare -Wsign-conversion -Wbitfield-enum-conversion -Wshorten-64-to-32 -Wstring-conversion -Werror -Wall -Wextra)
I get many errors like this when I try to build in visual studio. From debugging, I know that they are thrown by -Wall
:
error : 'constexpr' specifier is incompatible with C++98 [-Werror,-Wc++98-compat]
error : 'long long' is incompatible with C++98 [-Werror,-Wc++98-compat-pedantic]
error : use of this statement in a constexpr function is incompatible with C++ standards before C++14 [-Werror,-Wc++98-c++11-compat]
Questions:
- Why are c++98 errors thrown when I am running c++14?
- Why do these errors not get thrown when I am running the same project in linux, using the same CMakelists.txt? (On windows I am running clang 7.0.0, and on windows I am running clang 5.0.1)