Skip to content

conflicting declaration 'arduino::HardwareSerial Serial1' #3033

Closed

Description

@acronis2000

Hi !
Version 3.0.0 throws an error

`
#define Serial1_RX PA10 // Serial1 RX
#define Serial1_TX PA9 // Serial1 TX

HardwareSerial Serial1(Serial1_RX, Serial1_TX);

void setup() {
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:
}

C:\Users\Admin\AppData\Local\Temp.arduinoIDE-unsaved2026625-8432-6liyya.ubz86\sketch_jul25a\sketch_jul25a.ino:4:16: error: conflicting declaration 'arduino::HardwareSerial Serial1'
4 | HardwareSerial Serial1(Serial1_RX, Serial1_TX);
| ^~~~~~~
In file included from C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/WSerial.h:5,
from C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/wiring.h:103,
from C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Arduino.h:37,
from C:\Users\Admin\AppData\Local\arduino\sketches\870FFC002468014B87DE5543024610EC\sketch\sketch_jul25a.ino.cpp:1:
C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Serial.h:226:15: note: previous declaration as 'Uart Serial1'
226 | extern Uart Serial1;
| ^~~~~~~
exit status 1

Compilation error: conflicting declaration 'arduino::HardwareSerial Serial1'
`

Activity

  1. fpistm commented on Jul 25, 2026

    @fpistm
    Member

    Hi @acronis2000
    3.0.0 release deployed the ArduinoCore-API.
    HardwareSerial has been renamed Uart.

    That's why major release number changed. See #2879.

  2. whcir911 commented on Aug 6, 2026

    @whcir911

    Could you please show the proper syntax to use?

  3. Aymane-ST commented on Aug 6, 2026

    @Aymane-ST
    Contributor

    Could you please show the proper syntax to use?

    Hi ! Version 3.0.0 throws an error

    ` #define Serial1_RX PA10 // Serial1 RX #define Serial1_TX PA9 // Serial1 TX

    HardwareSerial Serial1(Serial1_RX, Serial1_TX);

    void setup() { // put your setup code here, to run once: }

    void loop() { // put your main code here, to run repeatedly: }

    C:\Users\Admin\AppData\Local\Temp.arduinoIDE-unsaved2026625-8432-6liyya.ubz86\sketch_jul25a\sketch_jul25a.ino:4:16: error: conflicting declaration 'arduino::HardwareSerial Serial1' 4 | HardwareSerial Serial1(Serial1_RX, Serial1_TX); | ^~~~~~~ In file included from C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/WSerial.h:5, from C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/wiring.h:103, from C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Arduino.h:37, from C:\Users\Admin\AppData\Local\arduino\sketches\870FFC002468014B87DE5543024610EC\sketch\sketch_jul25a.ino.cpp:1: C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Serial.h:226:15: note: previous declaration as 'Uart Serial1' 226 | extern Uart Serial1; | ^~~~~~~ exit status 1

    Compilation error: conflicting declaration 'arduino::HardwareSerial Serial1' `

    Hi,

    The issue is that since 3.0.0 (see 2d23c7c), the stm32duino concrete serial class is now Uart instead of HardwareSerial.

    So this old syntax is no longer valid:

    HardwareSerial Serial1(Serial1_RX, Serial1_TX);

    It should now be:

    Uart Serial1(Serial1_RX, Serial1_TX);

    So the migration is basically:

    HardwareSerial -> Uart

    Thanks.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions