Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Multiple Definition Error for MeMegaPi #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexanderCarlisi
Copy link

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

Steps to Reproduce :

create a new Header file, example : "TestHeader.h"
in TestHeader.h add #include "MeMegaPi.h"
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.

… mePort, encoder_Port, megapi_dc_Port, and megaPi_slots
@nbourre
Copy link

nbourre commented Sep 10, 2024

Please check #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants