2019-05-14 2:21 AM
Hi,
I my compiler always fails compilation on the first line of stm32l073xx.h, which is totally correct code.
stm32l073xx.h:70:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'I assume there is a syntax error in the file which includes the stm32l073xx.h.
So I was searching for the code
#include "stm32l073xx.h"in my project and in the HAL drivers, but I could not find it anywhere. Where is this file included? What other problem could cause this problem?
Thanks in advance,
Michael Schmid
2019-05-14 2:33 AM
The error can be anywhere between line 1 and 35. I guess by chance you put or erased some characters in that range. Look again!
2019-05-14 2:36 AM
the file is completely original from ST and correct code. I re-checked and downloaded the whole Cube FW package including this file once more from ST using cubeMX. The problem persists, so it can not be a problem in this file.
2019-05-14 2:37 AM
Cube generated code in main.h includes "stm32l0xx.h", which includes "stm32l073xx.h" (or other header, based of definitions).
2019-05-14 2:58 AM
interestingly, my cube generated main.h does only include stm32l0xx_hal.h, but it does two times: (i just regenerated the code, it stays the same)
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l0xx_hal.h"
#include "stm32l0xx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
2019-05-14 3:25 AM
Ah, I use LL, so it might be a bit different with HAL. Including the header twice is some kind of a bug but it shouldn't be a problem (granted the header contains standard header guard in the top). The issue must be in something else.
2019-05-14 4:36 AM
Ok, I found the problem... the stm32l073xx.h is included by stm32l0xx.h. I did not yet find out where, but one of my own source code files seemes to include this somewhere. In this .c file, I had a word written in the very beginning before the includes by mistake. This caused the problem, because the compiler included the files into my .c file just after the wrong word...
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.