Skip to content

"dynamic initialization" linking error when combining Menu::style and using rotaryEventIn.h #412

Open
@keldonin

Description

@keldonin
Collaborator

A linkage error occurs when using rotaryEnventIn.h in combination with combined Menu::style:

In this example, the combination

#include <menuIO/rotaryEventIn.h>

...

MENU(saveConfigSubMenu, "Save config", Menu::doNothing, Menu::noEvent, Menu::noStyle | Menu::showTitle,
  OP("OK", saveConfig, enterEvent),
  EXIT("<Cancel")
);

This is likely caused by this lines (amongst other) inside rotaryEventIn.h:

template<class T> inline T operator| (T a, T b) { return (T)((int)a | (int)b); }

As generic programming in this case tend to apply to all enums or classes using an overloaded operator. One can also question if an enumeration is the right object for a bit set?

Anyways, compiler and linker seem happy when generic overloaded operations are declared as constexpr.

PR to follow.

Activity

added a commit that references this issue on Mar 22, 2023
added a commit that references this issue on Mar 26, 2023

Merge pull request #413 from keldonin/master

7768070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @keldonin

        Issue actions

          "dynamic initialization" linking error when combining Menu::style and using rotaryEventIn.h · Issue #412 · neu-rah/ArduinoMenu