how to make CLion only recognize C++98 syntax

Answered

For some reason I cannot make CLion only use C++98.

  1. I keep getting clang-tidy for c++11 instead of c++98.
  2. I do not get any red lines or compiler errors when I use syntax for versions greater than C++98
  3. When I set the IDE to C++98 I want the IDE not to let me use any standard greater than C++98

Does anyone know how to enforce this standard in CLion?

 

I have set my CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
project(myProject)

set(CMAKE_CXX_STANDARD 98)

add_executable(myProject main.cpp Myclass.cpp Myclass.h)

2
1 comment

Hi!

>I keep getting clang-tidy for c++11 instead of c++98.

It's likely the issue with specific clang-tidy checks that don't respect current language level. Unfortunately, we can't handle it reliably on our side, however, you can disable the problematic ones (Alt+Enter on the warning - press "Right" select "Disable ... check").

>I do not get any red lines or compiler errors when I use syntax for versions greater than C++98

Please do Tools | CMake | Reset Cache and Reload Project. If warnings are still missing, please provide some code samples illustrating the issue.

-2

Please sign in to leave a comment.