Skip to main content
JulienD
Associate III
October 19, 2017
Question

STM32CubeMx autogeneration bug with C++ ?

  • October 19, 2017
  • 1 reply
  • 457 views
Posted on October 19, 2017 at 19:01

Hello

CubeMX 4.22.1

Cube for L1 1.8

CubeMx generates this kind of code in every initialization file like, for example 'adc.h'

#ifndef __adc_H

#define __adc_H

#ifdef __cplusplus

extern 'C' {

#endif

< snip>

extern void _Error_Handler(char*, int);

< snip>

#ifdef __cplusplus

}

#endif

#endif /*__ adc_H */

while in main.h

void _Error_Handler(char*, int);

is not surrounded by '#ifdef __cpluplus ....'

which leads to:

 error: conflicting declaration of 'void _Error_Handler(char*, int)' with 'C' linkage

shouldn't it be surounded by '#ifdef cplusplus'?

Thanks

Julien

    This topic has been closed for replies.

    1 reply

    Sirma Siang
    ST Employee
    October 24, 2017
    Posted on October 24, 2017 at 17:13

    Hello

    Devillers.Julien

    ,

    First I thank you for your feedback and correction proposal.

    You are absolutely right.

    This has been discussed in the following thread:

    https://community.st.com/0D50X00009XkXpXSAV

    The patch, which is exactly what you proposed, has been integrated in Cube4.

    Its availability will be no later than early Nov.

    Kind regards

    Sirma