Skip to main content
Associate III
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?

Best answer by Sule_Akcay

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

Thanks...

3 replies

STTwo-32
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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
AScha.3
Super User
March 12, 2024

Did you 

#include <string.h>

?

"If you feel a post has answered your question, please click ""Accept as Solution""."
Sule_AkcayAuthorAnswer
Associate III
March 12, 2024

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

Thanks...

Andrew Neil
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.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
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 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.