Mavlink communication with the C-UART Interface Example

Hi everyone,
I need your help please.
I just started working with the pixhawk and I need a communication between the Pixhawk and a Raspberry Pi.
I started with the C_Uart_Interface Example https://github.com/mavlink/c_uart_interface_example
but it doesnt work.

I have to add the following script to the mavlink_receiver.cpp file:

[Firmware/src/modules/mavlink/mavlink_receiver.cpp : line 1351]

   /* if read failed, this loop won't execute */
   for (ssize_t i = 0; i < nread; i++) {
   if (mavlink_parse_char(_mavlink->get_channel(), buf[i], &msg, &status)) {

    /* --- REPORT HANDLING OF MESSAGE --- */
    printf("\n");
    printf("HANDLE MESSAGE\n");
    printf("MSGID:%i\n",msg.msgid);

    /* handle generic messages and commands */
    handle_message(&msg);

but there is no declaration of the nread and buf variables in the decode_switch_pos_n topic (line 1335-1370).

And shouldn’t there be two } } after the code?

Thank you for your help

I got approximatively the same problem. Did you solve this ?