Multiple UART channels

Hello, I am building my first project on a Nucleo and I will need to get serial comms from my computer over USB and will also need to send a serial message to a motor controller.
I have set up the two channels as so but the void baud() function is throwing an error " Error: Incomplete type is not allowed" which leads me to think that it was expecting a different data type or something.
the line " Serial odrive(tx4,rx4);" is also giving me a no instance of constructor error.

So the first thing is what is going on there with the bugs (I am still researching this but if you beat me to it then great). Second and more importantly what are some best practices for doing this? I have some experience with the msp430 platform and of course Arduino but I wouldn’t say I have much experience overall, and I have no experience with arm-based controllers.

const int tx4 = 0x00; //pa_0;
const int rx4 = 0x01; //pa_1;

#include "mbed.h"
#include "Serial.h"
Serial pc(USBTX,USBRX);
Serial odrive(tx4,rx4);
void baud(115200);

Hello,

it is usually a good idea to give the name of the board, the version of MbedOS and the name of the tool you are using. That is necessary to reproduce your error.
Good start is read documentation - Mbed OS 6 Documentation but because you use Serial class then you probably use older MbedOS, lower than 6 - old Serial API docs.

You can pass the PinNames directly it is already mapped

#include "mbed.h"
#include "Serial.h"
Serial pc(USBTX,USBRX);
//Serial odrive(tx4,rx4);
Serial odrive(PA_0,PA_1);
DigitalOut led(LED1);

//void baud(115200); //what is the meaning
void setBaud(int hz); //forward declaration

int main(){
    setBaud(115200); // call
    while(1){
       if(pc.readable()){
            odrive.putc(pc.getc()); 
            led = !led;
       }
   }
}

void setBaud(int hz){ //implementation
    pc.baud(hz);
    odrive.baud(hz);
}

BR, Jan

Thank you for getting back with a helpful answer! I have a nucleo-F446RE and am currently using the online mbed compiler Compiler Deprecation | Mbed. I appreciate the documentation you pointed to. I am in a pinch to get this project out so I haven’t had quite as much time as I would have liked to learn the board, best compiler, and everything like that. The code you provided compiled and shows me that I was reading mbed help guide incorrectly.