Skip to main content
Graduate II
March 12, 2024
Solved

expected declaration specifiers or '...' before '....'

  • March 12, 2024
  • 3 replies
  • 9675 views

Hi!

I'm working with STM32CubeIDE and I want to send data via UART using the code below.

 

char *msg = "Hello\n";
HAL_UART_Transmit(&huart6, (uint8_t *) msg, strlen(msg), 100);

 

But I get an error like this:

hata.PNG

What can I do about this issue?

    This topic has been closed for replies.
    Best answer by Sule_Akcay

    I didn't understand what the problem was, but creating a new project solved my problem.

    Thanks...

    3 replies

    Technical Moderator
    March 12, 2024

    Hello @Sule_Akcay 

    I've tested personally using the Nucleo-F756ZG and I can't reproduce the issue. Can you add your project and all details about your board, your IDE version,... Personally, I'm using the CubeIDE  V1.14.1 and everything works fine.

    Best Regards.

    STTwo-32

    Super User
    March 12, 2024

    Did you 

    #include <string.h>

    ?

    Sule_AkcayAuthorAnswer
    Graduate II
    March 12, 2024

    I didn't understand what the problem was, but creating a new project solved my problem.

    Thanks...

    Super User
    March 12, 2024

    When you get errors like that, it generally means that something went wrong sometime earlier in your code - leaving the compiler confused.

    You haven't shown enough context to see what that might be.

    But as it's fixed now, please mark your last post as the solution - so people can see that this issue is resolved.

    Super User
    April 28, 2025

    @Andrew Neil wrote:

    When you get errors like that, it generally means that something went wrong sometime earlier in your code - leaving the compiler confused.


    For an example, see:

    https://community.st.com/t5/others-hardware-and-software/comment-after-backslash-in-define-causes-compile-errors/td-p/797033