Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-265

It's not possible to use C++17 functionality from interface headers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • Qt for MCUs 2.8
    • Qt for MCUs 2.5, Qt for MCUs 2.7
    • Platform Team, QUL Team
    • None

    Description

      When setting the C++ standard version from CMakeLists.txt:

      set(CMAKE_CXX_STANDARD 17)

      And trying to use C++ 17 features in the header files that are declared in InterfaceFiles in the qmlproject file, it will produce errors. For example, using std::optional like this

          std::optional<int> test() const;

      Causes the following error:

      /home/srodal/dev/qul/examples/painteditem/oscPaintedItem.h:38:10: error: no template named 'optional' in namespace 'std' 
      Error: no template named 'optional' in namespace 'std' 
      qmlinterfacegenerator -xc++ -resource-dir=/usr/lib/llvm-15/lib/clang/15.0.7 --target=arm-eabi-none-gnu -nostdinc -isystem/home/srodal/dev/qul/build_host/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include/c
      ++/10.3.1 -isystem/home/srodal/dev/qul/build_host/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include/c++/10.3.1/arm-none-eabi -isystem/home/srodal/dev/qul/build_host/bin/../src/3rdparty/gcc-arm-none-eabi-1
      0.3-2021.10/arm-none-eabi/include/c++/10.3.1/backward -isystem/home/srodal/dev/qul/build_host/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/include -isystem/home/srodal/dev/qul/build_host/bin/.
      ./src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/include-fixed -isystem/home/srodal/dev/qul/build_host/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include -I/home/srodal/dev/qul/bu
      ild_stm32f769i-discovery-baremetal-gcc/src/../include -I/home/srodal/dev/qul/include -I/home/srodal/dev/qul/build_stm32f769i-discovery-baremetal-gcc/examples/painteditem/CMakeFiles/painteditem.dir -I/home/srodal/dev/qul/include
      -I/home/srodal/dev/qul/build_stm32f769i-discovery-baremetal-gcc/examples/painteditem//CMakeFiles/painteditem.dir/ -I/home/srodal/dev/qul/examples/painteditem -I/home/srodal/dev/qul/build_stm32f769i-discovery-baremetal-gcc/exam
      ples/painteditem//CMakeFiles/Lib_painteditem_3f98.dir/ -I/home/srodal/dev/qul/build_stm32f769i-discovery-baremetal-gcc/include -I/home/srodal/dev/qul/build_stm32f769i-discovery-baremetal-gcc/src/controls -I/home/srodal/dev/qul/
      build_stm32f769i-discovery-baremetal-gcc/include/qul/Default /home/srodal/dev/qul/examples/painteditem/oscPaintedItem.h

      Ideally, the CMAKE_CXX_STANDARD value set in CMakeLists.txt should be forwarded by qmlprojectexporter to qmlinterfacegenerator using the  `-std=c++${CMAKE_CXX_STANDARD}` command line option.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              srodal Samuel Rødal
              srodal Samuel Rødal
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes