cancel
Showing results for 
Search instead for 
Did you mean: 

where is stm32l073xx.h included?

Schmid.M.
Senior

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

6 REPLIES 6
Uwe Bonnes
Principal II

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!

Schmid.M.
Senior

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.

Cube generated code in main.h includes "stm32l0xx.h", which includes "stm32l073xx.h" (or other header, based of definitions).

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 */

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.

Schmid.M.
Senior

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