Hi All
I have been chasing my tail all day with this error. I have fixed a few of the variables defintions thanks to all the suggestins above and looked at “A new PlatformIO user coding wrong, getting multiple definition & first defined here errors - #2 by maxgerhardt.”
Here is my error:
Linking .pio\build\portenta_h7_m7\firmware.elf
.pio\build\portenta_h7_m7\src\main.cpp.o:(.bss.Breakout+0x0): multiple definition of `Breakout'
.pio\build\portenta_h7_m7\src\BuckosLib_PH7_v001.cpp.o:(.bss.Breakout+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\portenta_h7_m7\firmware.elf] Error 1
======================================================= [FAILED] Took 6.23 seconds =======================================================
* The terminal process "C:\Users\bucko\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
“multiple definition of `Breakout’” Breakout is from <Arduino_PortentaBreakout.h>
Here is my structure
here is my “BuckosLib_PH7_v001.h”
/* BUCKOS HEADER FILE BuckosLib_PH7_v001
Header file for BuckosLib_PH7_v001.cpp
Vaersion: 001
Date: 19 Apr 2023
*/
#pragma once
#ifndef BUCKOSLIB_PHY_V001_H
#define BUCKOSLIB_PHY_V001_H
#include <Arduino.h>
#include <Arduino_PortentaBreakout.h>
#include <LiquidCrystal.h>
#include <ArduinoBLE.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
extern int rs, en, d4, d5, d6 , d7;
//const int
// Declare Functions
void flashF3 (int LedF3,int FlashCount,int DelayTime);
void PrintToLCD (String Message, String YesNo, int Line =1);
void IntLCD();
#endif
Here is my “BuckosLib_PH7_v001.cpp”
#include <Arduino.h>
#include <Arduino_PortentaBreakout.h>
#include <LiquidCrystal.h>
#include <ArduinoBLE.h>
#include "BuckosLib_PH7_v001.h"
int rs = GPIO_0, en = GPIO_1;
int d4 = GPIO_5, d5 = GPIO_4, d6 = GPIO_3, d7 = GPIO_2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// Functions
void flashF3 (int LedF3,int FlashCount,int DelayTime)
{
digitalWrite(LedF3, HIGH);
lcd.setBacklight(HIGH);
//lcd.set
delay(DelayTime * 2);
for(int i=1; i <= FlashCount; i++ ) {
digitalWrite(LedF3, LOW); // On
lcd.setBacklight(LOW);
delay(DelayTime);
digitalWrite(LedF3, HIGH); //off
lcd.setBacklight(HIGH);
delay(DelayTime);
}
}
void PrintToLCD (String Message, String YesNo, int Line)
{
if (YesNo == "Yes") {
lcd.clear();
}
if (Line ==1) {
lcd.setCursor(0,0);
} else {
lcd.setCursor(0,1);
}
lcd.print(Message);
}
void IntLCD() {
Serial.begin(9600);
//while (!Serial); // Uncomment to wait for serial port to connect.
// Set LED pin to output mode
lcd.begin(16, 2);
lcd.clear();
lcd.display();
}