AnsweredAssumed Answered

STM32CubeMx autogeneration bug with C++ ?

Question asked by JulienD on Oct 19, 2017
Latest reply on Oct 24, 2017 by Sirma Siang

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

Outcomes