"error: function definition does not declare parameters" when using value initializers in native

I’m attempting to set up a native environment that will use a simulator on my computer, and when I go to compile my program I get errors on every class member that is using value initialization:

In file included from src/dbuddy.cpp:4:
In file included from include/dbuddy.h:4:
In file included from include/ui.h:6:
include/widget.h:42:20: error: function definition does not declare parameters
        lv_obj_t * self{};

When I compile using my MCU profile (NodeMCU32-s) everything compiles and uploads just fine.

I’m using LVGL’s PlatformIO configuration for the native environment, and below is my platformio.ini:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = nodemcu-32s

[common]
build_flags =
    -D LV_CONF_INCLUDE_SIMPLE
    -I .
    -I include
lib_deps =
    lvgl/lvgl@^7.9.1
lib_archive = false
src_filter =
    +<*>

[env:nodemcu-32s]
build_flags =
    ${common.build_flags}
platform = espressif32
board = nodemcu-32s
framework = arduino
lib_deps =
    ${common.lib_deps}
    EEPROM
    SPI
    Wire
    adafruit/Adafruit BusIO@^1.7.1
    adafruit/Adafruit GFX Library@^1.10.4
    adafruit/Adafruit RA8875@^1.4.0
monitor_port = /dev/cu.usbserial-0001
monitor_speed = 115200
monitor_filters = time, default, printable

[env:native]
platform = native@^1.1.3
extra_scripts = support/sdl2_build_extra.py
build_flags =
    ${common.build_flags}
; Use 32-bits build when possible, for correct memory stat display. You need
; `:i386` sdl2 libs installed. Comment this option for 64-bits build.
    !python -c "import platform; print('-m32' if platform.system() in [ 'Linux' ] else '')"
; Add recursive dirs for hal headers search
    !python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
    -lSDL2
; SDL drivers options
    -D LV_LVGL_H_INCLUDE_SIMPLE
    -D LV_DRV_NO_CONF
    -D USE_MONITOR
    -D MONITOR_ZOOM=2
    -D USE_MOUSE
    -D USE_MOUSEWHEEL
    -D USE_KEYBOARD
lib_deps =
    ${common.lib_deps}
    lv_drivers@~7.9.0
;lv_drivers=https://github.com/littlevgl/lv_drivers/archive/7d71907c1d6b02797d066f50984b866e080ebeed.zip
src_filter =
    ${common.src_filter}
    +<../hal/sdl2>

I’m also using CLion and the PlatformIO plugin. I’ve tried adding --std=c++11 (and 14, 17, and latest) to CLion’s CMake options for my native profile under Build, Execution, Deployment > CMake preferences without any luck.

If it helps, my code is available.

Hm that’s weird, when I apply a few code fixes (do not include Arduino.h for native envs, include #include <ctime> for time() functions, reconfigure lvgl to use no LV_TICK_CUSTOM, create main() function that calls setup() and loop() on the desktop) and some platformio.ini fixes (-I and -L the folder where my SDL2 libs are), your program compiles and starts right up (after copying SDL2.dll into the folder where the program.exe is), on Windows 10.

No idea what I’m looking at but, there’s a clock and a console and the clock updates to the current time.

And compiler is

C:\Users\Max>gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I’ll check in Linux VM.

Compiles in Ubunutu 20.04 in 64-bit mode, too. (Didn’t bother installing 32-bit support for my compiler and libs, it failed in stdint.h when using -m32…)

Compiler is

$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The modified project with code fixes and to native envs for Windows and Linux can be found at GitHub - maxgerhardt/dbuddy: dbuddy is short for "Desk Buddy", and will serve as a desktop device to constantly show iCal calendars on a touchscreen..

Verbose build logs for Linux are also found in the repo for comparison (pio run -v).

Other than comparing that to what you have and the compiler version and updating PlatformIO (pio upgrade --dev) with all platforms (pio platform update), and checking the standard C++ version of the compiler (since it isn’t explicitly specified on the commandline, see log) I don’t have more advice :confused:

PS: If I use a sleep function in the while(true) { loop(); }, the CPU gets freed up while keeping FPS the same, there’s also a commit for that.

Thanks for catching those little gotchas about including Arduino.h when not supposed to and the ctime include. I guess IDEs aren’t perfect, because mine never hinted that anything was wrong.

Unfortunately, I have the same issue when running the PlatformIO Upload in the IDE, but now if I run it on the command line it gives me a different error about SDL2/SDL.h not being found.

I added the -I and -L for where my local SDL is located, but then I start going down a rabbit hole of having to add includes for every file in the SDL library that PlatformIO cannot find. I thought PlatformIO was supposed to manage my dependencies for me? Is there an OS environment that PlatformIO imports?

I forgot to mention it before, but I’m on MacOS Catalina. I have SDL2 installed via homebrew in my /usr/local/include and /usr/local/lib, respectively.

IDE PlatformIO Upload Task:

Processing native (platform: native@^1.1.3)
--------------------------------------------------------------------------------
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <lvgl> 7.10.0 (/Users/kstanl27/Development/dbuddy/.pio/libdeps/native/lvgl)
|-- <lv_drivers> 7.9.1 (/Users/kstanl27/Development/dbuddy/.pio/libdeps/native/lv_drivers)
|   |-- <lvgl> 7.10.0 (/Users/kstanl27/Development/dbuddy/.pio/libdeps/native/lvgl)
Building in release mode
g++ -o .pio/build/native/src/dbuddy.o -c -DPLATFORMIO=50100 -DLV_CONF_INCLUDE_SIMPLE -DLV_LVGL_H_INCLUDE_SIMPLE -DLV_DRV_NO_CONF -DUSE_MONITOR -DMONITOR_ZOOM=2 -DUSE_MOUSE -DUSE_MOUSEWHEEL -DUSE_KEYBOARD -Isrc -I.pio/libdeps/native/lv_drivers -I.pio/libdeps/native/lvgl -I.pio/libdeps/native/lvgl/src -I. -Iinclude src/dbuddy.cpp
g++ -o .pio/build/native/src/fonts.o -c -DPLATFORMIO=50100 -DLV_CONF_INCLUDE_SIMPLE -DLV_LVGL_H_INCLUDE_SIMPLE -DLV_DRV_NO_CONF -DUSE_MONITOR -DMONITOR_ZOOM=2 -DUSE_MOUSE -DUSE_MOUSEWHEEL -DUSE_KEYBOARD -Isrc -I.pio/libdeps/native/lv_drivers -I.pio/libdeps/native/lvgl -I.pio/libdeps/native/lvgl/src -I. -Iinclude src/fonts.cpp
g++ -o .pio/build/native/src/hal.o -c -DPLATFORMIO=50100 -DLV_CONF_INCLUDE_SIMPLE -DLV_LVGL_H_INCLUDE_SIMPLE -DLV_DRV_NO_CONF -DUSE_MONITOR -DMONITOR_ZOOM=2 -DUSE_MOUSE -DUSE_MOUSEWHEEL -DUSE_KEYBOARD -Isrc -I.pio/libdeps/native/lv_drivers -I.pio/libdeps/native/lvgl -I.pio/libdeps/native/lvgl/src -I. -Iinclude src/hal.cpp
g++ -o .pio/build/native/src/main.o -c -DPLATFORMIO=50100 -DLV_CONF_INCLUDE_SIMPLE -DLV_LVGL_H_INCLUDE_SIMPLE -DLV_DRV_NO_CONF -DUSE_MONITOR -DMONITOR_ZOOM=2 -DUSE_MOUSE -DUSE_MOUSEWHEEL -DUSE_KEYBOARD -Isrc -I.pio/libdeps/native/lv_drivers -I.pio/libdeps/native/lvgl -I.pio/libdeps/native/lvgl/src -I. -Iinclude src/main.cpp
In file included from src/dbuddy.cpp:5:
In file included from include/dbuddy.h:4:
In file included from include/ui.h:6:
include/widget.h:42:20: error: function definition does not declare parameters
        lv_obj_t * self{};
                   ^
include/widget.h:25:20: error: use of undeclared identifier 'self'
            delete self;
                   ^
include/widget.h:38:40: error: use of undeclared identifier 'self'
        lv_obj_t * get_self() { return self; }
                                       ^
include/widget.h:39:39: error: use of undeclared identifier 'self'
        void set_self(lv_obj_t * s) { self = s; }
                                      ^
In file included from src/dbuddy.cpp:5:
In file included from include/dbuddy.h:4:
In file included from include/ui.h:7:
include/fonts.h:11:31: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Fonts(Fonts &other) = delete;
                              ^
include/fonts.h:12:41: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        void operator=(const Fonts &) = delete;
                                        ^
include/fonts.h:20:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_medium{};
                                             ^
include/fonts.h:21:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_small{};
                                             ^
include/fonts.h:22:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_xxlarge{};
                                             ^
include/fonts.h:23:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * regular_small{};
                                             ^
include/fonts.h:24:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * regular_xsmall{};
                                             ^
In file included from src/dbuddy.cpp:5:
In file included from include/dbuddy.h:4:
In file included from include/ui.h:8:
include/styles.h:16:33: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Styles(Styles &other) = delete;
                                ^
include/styles.h:17:42: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        void operator=(const Styles &) = delete;
                                         ^
include/styles.h:59:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_blend_mode_additive{};
                                             ^
include/styles.h:60:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_blend_mode_subtractive{};
                                             ^
include/styles.h:61:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_black{};
                                             ^
include/styles.h:62:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_blue{};
                                             ^
include/styles.h:63:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_none{};
                                             ^
include/styles.h:64:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_purple{};
                                             ^
include/styles.h:65:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_white{};
                                             ^
include/styles.h:66:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_overlay{};
                                             ^
include/styles.h:67:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_transparent_10{};
                                             ^
include/styles.h:68:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_transparent_20{};
                                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 warnings and 20 errors generated.
*** [.pio/build/native/src/dbuddy.o] Error 1
In file included from src/fonts.cpp:1:
include/fonts.h:11:31: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Fonts(Fonts &other) = delete;
                              ^
include/fonts.h:12:41: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        void operator=(const Fonts &) = delete;
                                        ^
include/fonts.h:20:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_medium{};
                                             ^
include/fonts.h:21:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_small{};
                                             ^
include/fonts.h:22:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_xxlarge{};
                                             ^
include/fonts.h:23:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * regular_small{};
                                             ^
include/fonts.h:24:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * regular_xsmall{};
                                             ^
src/fonts.cpp:8:5: error: use of undeclared identifier 'black_medium'
    black_medium = new std::map<lv_state_t, lv_style_t *>();
    ^
src/fonts.cpp:9:5: error: use of undeclared identifier 'black_small'
    black_small = new std::map<lv_state_t, lv_style_t *>();
    ^
src/fonts.cpp:10:5: error: use of undeclared identifier 'black_xxlarge'
    black_xxlarge = new std::map<lv_state_t, lv_style_t *>();
    ^
src/fonts.cpp:11:5: error: use of undeclared identifier 'regular_small'
    regular_small = new std::map<lv_state_t, lv_style_t *>();
    ^
src/fonts.cpp:12:5: error: use of undeclared identifier 'regular_xsmall'
    regular_xsmall = new std::map<lv_state_t, lv_style_t *>();
    ^
src/fonts.cpp:14:30: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
    for (unsigned char STATE : STATES) {
                             ^
src/fonts.cpp:15:19: error: use of undeclared identifier 'black_medium'
        init_font(black_medium, STATE);
                  ^
src/fonts.cpp:16:32: error: use of undeclared identifier 'black_medium'
        lv_style_set_text_font(black_medium->at(STATE), STATE, &roboto_black_24);
                               ^
src/fonts.cpp:18:19: error: use of undeclared identifier 'black_small'
        init_font(black_small, STATE);
                  ^
src/fonts.cpp:19:32: error: use of undeclared identifier 'black_small'
        lv_style_set_text_font(black_small->at(STATE), STATE, &roboto_black_16);
                               ^
src/fonts.cpp:21:19: error: use of undeclared identifier 'black_xxlarge'
        init_font(black_xxlarge, STATE);
                  ^
src/fonts.cpp:22:32: error: use of undeclared identifier 'black_xxlarge'
        lv_style_set_text_font(black_xxlarge->at(STATE), STATE, &roboto_black_72);
                               ^
src/fonts.cpp:24:19: error: use of undeclared identifier 'regular_xsmall'
        init_font(regular_xsmall, STATE);
                  ^
src/fonts.cpp:25:32: error: use of undeclared identifier 'regular_xsmall'
        lv_style_set_text_font(regular_xsmall->at(STATE), STATE, &roboto_regular_14);
                               ^
src/fonts.cpp:27:19: error: use of undeclared identifier 'regular_small'
        init_font(regular_small, STATE);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
*** [.pio/build/native/src/fonts.o] Error 1
In file included from src/hal.cpp:3:
include/hal.h:20:40: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
        lv_disp_buf_t * display_buffer = new lv_disp_buf_t;
                                       ^
include/hal.h:21:40: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
        lv_disp_drv_t * display_driver = new lv_disp_drv_t;
                                       ^
include/hal.h:23:22: error: function definition does not declare parameters
        lv_color_t * buffer0[BUFFER_SIZE]{};
                     ^
include/hal.h:24:22: error: function definition does not declare parameters
        lv_color_t * buffer1[BUFFER_SIZE]{};
                     ^
src/hal.cpp:18:42: error: use of undeclared identifier 'buffer0'
        lv_disp_buf_init(display_buffer, buffer0, buffer1, BUFFER_SIZE);
                                         ^
src/hal.cpp:18:51: error: use of undeclared identifier 'buffer1'
        lv_disp_buf_init(display_buffer, buffer0, buffer1, BUFFER_SIZE);
                                                  ^
src/hal.cpp:20:42: error: use of undeclared identifier 'buffer0'
        lv_disp_buf_init(display_buffer, buffer0, nullptr, BUFFER_SIZE);
                                         ^
2 warnings and 5 errors generated.
*** [.pio/build/native/src/hal.o] Error 1
In file included from src/main.cpp:3:
In file included from include/dbuddy.h:4:
In file included from include/ui.h:6:
include/widget.h:42:20: error: function definition does not declare parameters
        lv_obj_t * self{};
                   ^
include/widget.h:25:20: error: use of undeclared identifier 'self'
            delete self;
                   ^
include/widget.h:38:40: error: use of undeclared identifier 'self'
        lv_obj_t * get_self() { return self; }
                                       ^
include/widget.h:39:39: error: use of undeclared identifier 'self'
        void set_self(lv_obj_t * s) { self = s; }
                                      ^
In file included from src/main.cpp:3:
In file included from include/dbuddy.h:4:
In file included from include/ui.h:7:
include/fonts.h:11:31: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Fonts(Fonts &other) = delete;
                              ^
include/fonts.h:12:41: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        void operator=(const Fonts &) = delete;
                                        ^
include/fonts.h:20:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_medium{};
                                             ^
include/fonts.h:21:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_small{};
                                             ^
include/fonts.h:22:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * black_xxlarge{};
                                             ^
include/fonts.h:23:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * regular_small{};
                                             ^
include/fonts.h:24:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * regular_xsmall{};
                                             ^
In file included from src/main.cpp:3:
In file included from include/dbuddy.h:4:
In file included from include/ui.h:8:
include/styles.h:16:33: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        Styles(Styles &other) = delete;
                                ^
include/styles.h:17:42: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
        void operator=(const Styles &) = delete;
                                         ^
include/styles.h:59:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_blend_mode_additive{};
                                             ^
include/styles.h:60:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_blend_mode_subtractive{};
                                             ^
include/styles.h:61:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_black{};
                                             ^
include/styles.h:62:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_blue{};
                                             ^
include/styles.h:63:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_none{};
                                             ^
include/styles.h:64:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_purple{};
                                             ^
include/styles.h:65:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_color_white{};
                                             ^
include/styles.h:66:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_overlay{};
                                             ^
include/styles.h:67:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_transparent_10{};
                                             ^
include/styles.h:68:46: error: function definition does not declare parameters
        std::map<lv_state_t, lv_style_t *> * background_transparent_20{};
                                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 warnings and 20 errors generated.
*** [.pio/build/native/src/main.o] Error 1
========================== [FAILED] Took 8.99 seconds ==========================

Environment    Status    Duration
-------------  --------  ------------
native         FAILED    00:00:08.994
==================== 1 failed, 0 succeeded in 00:00:08.994 ====================
make[3]: *** [CMakeFiles/Production] Error 1
make[2]: *** [CMakeFiles/Production.dir/all] Error 2
make[1]: *** [CMakeFiles/Production.dir/rule] Error 2
make: *** [Production] Error 2

Compiler version:

13:40 $ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Aah, you’re on Mac not Linux. Anyways, this line suggests that it’s running it’s running in C++11 mode with some extensions missing? Or clang has a quirk there.

By using this I found that my native compiler on Linux has C++14 as the standard. So maybe try adding -std=c++14 to the build_flags.

Hmm that’s not good, on Windows I only ever needed on -I to the include path (the folder that has the SDL2 folder, not the SDL2 folder itself) and one -L to where the .a and .so files for SDL2 are.

If Mac has the pkg-config thing available, you might try this to find out which flags you need regarding include and link.

PlatformIO for CLion uses C++11 by default, and the only way I see of changing that in PlatformIO is already being used by default (see below). As for CLion, that’s a whole different beast (pun intended) and outside of the scope of this forum I presume.

Here is the relevant section from my CMakeListsPrivate.txt which is auto generated by PlatformIO:


SET(CMAKE_C_COMPILER "$ENV{HOME}/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc")
SET(CMAKE_CXX_COMPILER "$ENV{HOME}/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-g++")
SET(CMAKE_CXX_FLAGS "-fno-rtti -fno-exceptions -std=gnu++11 -Os -g3 -Wall -nostdlib -Wpointer-arith -Wno-error=unused-but-set-variable -Wno-error=unused-variable -mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=deprecated-declarations -Wno-error=unused-function -Wno-unused-parameter -Wno-sign-compare -fstack-protector -fexceptions -Werror=reorder")
SET(CMAKE_C_FLAGS "-std=gnu99 -Wno-old-style-declaration -Os -g3 -Wall -nostdlib -Wpointer-arith -Wno-error=unused-but-set-variable -Wno-error=unused-variable -mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=deprecated-declarations -Wno-error=unused-function -Wno-unused-parameter -Wno-sign-compare -fstack-protector -fexceptions -Werror=reorder")

SET(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)

Obviously I would imagine the CMAKE_CXX_COMPILER gets overwritten by my local compiler when compiling native, so maybe it’s also overwriting my CMAKE_CXX_FLAGS as well. I’m not sure, and I don’t know how to tell or change that behavior if it’s true.

When I manually add --std=c++14 to my build_flags, then gcc complains because --std isn’t a supported flag. I need gcc in my project because of the fonts. But on the bright side, it did resolve the c++11 errors. :slight_smile:

I’m upgrading my command-line tools in case something in that may help the situation. I’m a little surprised there isn’t a more straight-forward way to manage standards in both CLion and PlatformIO. Heck, even having a build_cxx_flags (and build_cc_flags) in the config could solve this type of problem, and open up mixed projects like mine for greater flexibility.

Edit: Looking at g++ -dM -E -x c++ /dev/null | grep -F __cplusplus does show 199711L. Hopefully upgrading my dev tools will “fix” this. Otherwise I’ve got to figure out how to do it in the environment.

-std=c++14, with one dash, that’s a caveat.

Also the CMakeLists.txt only exposes the IntelliSense features to CLion, it does not actually build the files with CMake. In the end, it will just call into the pio executable.

Welp than that’s pretty likely the culprit.

:man_facepalming: :slight_smile: