Hi,
I have this clone controller:
Which worked well before on OpenPLC 3.0 version using STM32 2.7.1 board package.
But recentlty I installed the new OpenPLC v4.2, also I installed STM32 3.0.0 board package using Arduino IDE board manager, which OpenPLC uses the same path to build its projects.
So when I wanted to compile a simple project, I got this error:
[27-08-26 13:40:59]: Arduino compile failed: Compilation failed with code 1
[27-08-26 13:40:59]: H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src\arduino.cpp:37:16: error: conflicting declaration 'arduino::HardwareSerial Serial3'
[27-08-26 13:40:59]: 37 | HardwareSerial Serial3(PC11_ALT1, PC_10_ALT1); //needed to use Serial3 for RS485 - also define PA14 as TxPin
[27-08-26 13:40:59]: | ^~~~~~~
[27-08-26 13:40:59]: In file included from C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/WSerial.h:5,
[27-08-26 13:40:59]: from C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/wiring.h:103,
[27-08-26 13:40:59]: from C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Arduino.h:37,
[27-08-26 13:40:59]: from H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src\arduino.cpp:5:
[27-08-26 13:40:59]: C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Serial.h:232:14: note: previous declaration as 'Uart Serial3'
[27-08-26 13:40:59]: 232 | extern Uart Serial3;
[27-08-26 13:40:59]: | ^~~~~~~
[27-08-26 13:40:59]: Multiple libraries were found for "OpenPLCUserLib.h"
[27-08-26 13:40:59]: Used: C:\Users\wopre\AppData\Local\Temp\openplc-precompile-23de1952502a-12584\OpenPLCUserLib
[27-08-26 13:40:59]: Not used: H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src
[27-08-26 13:40:59]: Error during build: exit status 1
[27-08-26 13:40:59]: STruC++ compilation failed:
[27-08-26 13:40:59]: Compilation failed with code 1
H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src\arduino.cpp:37:16: error: conflicting declaration 'arduino::HardwareSerial Serial3'
37 | HardwareSerial Serial3(PC11_ALT1, PC_10_ALT1); //needed to use Serial3 for RS485 - also define PA14 as TxPin
| ^~~~~~~
In file included from C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/WSerial.h:5,
from C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/wiring.h:103,
from C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Arduino.h:37,
from H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src\arduino.cpp:5:
C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino/Serial.h:232:14: note: previous declaration as 'Uart Serial3'
232 | extern Uart Serial3;
| ^~~~~~~
Multiple libraries were found for "OpenPLCUserLib.h"
Used: C:\Users\wopre\AppData\Local\Temp\openplc-precompile-23de1952502a-12584\OpenPLCUserLib
Not used: H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src
Error during build: exit status 1
[27-08-26 13:40:59]: Arduino compilation failed
[27-08-26 13:40:59]: Stopping compilation process.
[27-08-26 13:40:59]: -------------------------------------------------------------------------------------------------------------
So, I have an error because `Serial3` is declared in STM32 3.0.0 core line 232 at:
C:\Users\wopre\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\3.0.0\cores\arduino\Serial.h
And then OpenPLC also declares it too during project build process at the start of file:
H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src\arduino.cpp
C:\Users\wopre\AppData\Local\Programs\open-plc-editor\resources\sources\hal\fx3u-14-WS3U.cpp
And also the project's build source folder:
H:\projects_electronics_programming\openPLC projects\openPLC 4.2 projects\build\WS3U-14Mx\src\arduino.cpp
And if I edit anything, OpenPLC overwrites it.
I tried to solve it with ChatGPT and Gemini but no luck ![]()



