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

qmlinterfacegenerator fails when the project uses a newer C++ standard

XMLWordPrintable

    • 8e78c60bda9430fc9a43e9a1f70ca8d1ed7a261b, eae2d2a49dee374d3a6f7340fffae7d74d7c79ae

      Attached a modified image_loading example. The example is extended to use C++17 for the complete example.

      While that works great for the main.cpp, it doesn't work when it is used inside a C++ class (myitem.h) and exposed to QML using qul_target_generate_interfaces.

      MyItem is using std::optional a feature which got introduced in C++17.

      The example cannot be compiled and fails with the following error:

      _qul_dummy_myitem.h && /home/gagi/Qt/QtMCUs/2.5.0/bin/qmlinterfacegenerator -xc++ /home/gagi/Qt/QtMCUs/2.5.0/examples/image_loading/myitem.h -resource-dir="/home/gagi/Qt/QtMCUs/2.5.0/lib/clang/13.0.1" -I/home/gagi/Qt/QtMCUs/2.5.0/examples/image_loading -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug/CMakeFiles/image_loading.dir -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug/src/controls -I/home/gagi/Qt/QtMCUs/2.5.0/examples/image_loading -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug/CMakeFiles/image_loading.dir -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug//CMakeFiles/image_loading.dir/ -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug/CMakeFiles/image_loading.dir -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug/src/controls -I/home/gagi/Qt/QtMCUs/2.5.0/examples/image_loading -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug/CMakeFiles/image_loading.dir -I/home/gagi/Qt/QtMCUs/2.5.0/examples/build-image_loading-Qt_for_MCUs_2_5_STM32F769I_DISCOVERY_BAREMETAL_32bpp_ARMGCC-Debug//CMakeFiles/Lib_image_loadin46fd.dir/ -I/home/gagi/Qt/QtMCUs/2.5.0/include/qul/Default -I/home/gagi/Qt/QtMCUs/2.5.0/include/qul/Templates -I/home/gagi/Qt/QtMCUs/2.5.0/include --target=arm-eabi-none-gnu -nostdinc -isystem/home/gagi/Qt/QtMCUs/2.5.0/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include/c++/10.3.1 -isystem/home/gagi/Qt/QtMCUs/2.5.0/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include/c++/10.3.1/arm-none-eabi -isystem/home/gagi/Qt/QtMCUs/2.5.0/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include/c++/10.3.1/backward -isystem/home/gagi/Qt/QtMCUs/2.5.0/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/include -isystem/home/gagi/Qt/QtMCUs/2.5.0/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1/include-fixed -isystem/home/gagi/Qt/QtMCUs/2.5.0/bin/../src/3rdparty/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include
      warning: unknown platform, assuming -mfloat-abi=soft
      warning: unknown platform, assuming -mfloat-abi=soft
      warning: unknown platform, assuming -mfloat-abi=soft
      /home/gagi/Qt/QtMCUs/2.5.0/examples/image_loading/myitem.h:9:10: error: no template named 'optional' in namespace 'std'
      

      It would be great if the interefacegenerator would be called with the same flags than the all other C++ files.

      If that is not possible, adding an extra variable which enables the user to provide extra flags to the interfacegenerator would fix the problem.

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

            rakeller Rainer Keller
            gagi Dominik Holland
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes