Skip to main content
Schmid.M.
Associate III
May 14, 2019
Question

where is stm32l073xx.h included?

  • May 14, 2019
  • 6 replies
  • 1289 views

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

This topic has been closed for replies.

6 replies

Uwe Bonnes
Chief
May 14, 2019

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.
Schmid.M.Author
Associate III
May 14, 2019

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.

After Forever
Senior III
May 14, 2019

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

Schmid.M.
Schmid.M.Author
Associate III
May 14, 2019

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

After Forever
Senior III
May 14, 2019

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.
Schmid.M.Author
Associate III
May 14, 2019

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