Skip to content

Multiple Definition Errors when using MeMegaPi.h #82

@AlexanderCarlisi

Description

@AlexanderCarlisi

Having multiple code files that include "MeMegaPi.h" causes a Multiple Definitions error.

Steps to Reproduce :

  1. create a new Header file, example : "TestHeader.h"
  2. in TestHeader.h add #include "MeMegaPi.h"
  3. in your main .INO file #include "TestHeader.h"

Cause :
The MeMegaPi.h file contains variable definitions instead of declarations, leading to multiple definitions when included in multiple compilation units.

Solution:
We moved the variable definitions from MeMegaPi.h to MeMegaPi.cpp and declared them as extern in MeMegaPi.h. This change ensures the variables are only defined once, resolving the multiple definition errors.

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

    Issue actions