# Compiler flag errors

**URL:** <https://root-forum.cern.ch/t/compiler-flag-errors/61908>\
**Category:** Newbie\
**Tags:** root\
**Created:** [October 10, 2024, 1:02pm UTC](https://root-forum.cern.ch/t/compiler-flag-errors/61908 "2024-10-10T13:02:08Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [October 10, 2024, 4:53pm UTC](https://root-forum.cern.ch/t/compiler-flag-errors/61908/5 "2024-10-10T16:53:45Z")

</div>

Your source code may be “sensitive” to the “`ROOT_CXX_FLAGS`” and “`ROOT_CXX_STANDARD`” variables (which come from [ROOT](https://root.cern/manual/integrate_root_into_my_cmake_project/)).

The problem is that you may have (note “`undefined`”):

```plaintext
ROOT_CXX_FLAGS -std=c++17 -pipe -fsigned-char -pthread
ROOT_CXX_STANDARD undefined

```

or (note the missing “`-std=c++17`”):

```plaintext
ROOT_CXX_FLAGS -pipe -fsigned-char -pthread
ROOT_CXX_STANDARD 17

```

Try the simple “`CMakeLists.txt`” file from (just execute “`cmake .`”):

> [@CMake variable ROOT\_CXX\_STANDARD not set](https://root-forum.cern.ch/t/cmake-variable-root-cxx-standard-not-set/59207):
>
> ROOT Version: 6.08.06 - 6.30.06 Platform: Ubuntu 22.04 Compiler: gcc According to [Integrating ROOT into CMake projects - ROOT](https://root.cern/manual/integrate_root_into_my_cmake_project/) "Calling find\_package(ROOT) makes the following variables available Variable Type Description ROOT\_INCLUDE\_DIRS PATH Include directories for the ROOT installation. ROOT\_LIBRARIES LIST Libraries to link against. The actual list of libraries is composed using the COMPONENTS listed in the find\_package(…) command. ROOT\_DEFINITIONS STRING Compile definitions …

> [@Getting the c++ standard if ROOT\_CXX\_STANDARD is not set](https://root-forum.cern.ch/t/getting-the-c-standard-if-root-cxx-standard-is-not-set/59439):
>
> The original topic got closed, but in case anyone else encounters this problem: If the ROOT\_CXX\_STANDARD variable is not set in cmake (ROOT versions 6.30.06 and earlier), I found the code can be used to get the c++ standard used to compile the ROOT version in use: if(NOT ROOT\_CXX\_VERSION) string(REGEX REPLACE ".\*-std=.+\\+\\+([0-9][0-9]).\*" "\\1" ROOT\_CXX\_VERSION ${ROOT\_CXX\_FLAGS}) if(${CMAKE\_MATCH\_COUNT} EQUAL "1") message("Got ROOT\_CXX\_VERSION=${ROOT\_CXX\_VERSION} from \"${ROOT\_CX…

---

_[View the full topic](https://root-forum.cern.ch/t/compiler-flag-errors/61908)._
