I really need help here because I'm trying to make a project for stm32f10x microcontrollers, I've found in the following thread of Keil forum

Libray forum

that the best way to add the library to a project is to add the needed files to the project folder and use them.

The problem here is that I did that and right now the compiler is giving me a lot of errors of the type

./stm32f10x_gpio.h(349): error: unknown type name 'GPIO_TypeDef'

The previous is one of the 76 errors that the compiler gave me on definitions. I have the ST document about how to migrate projects from the old library to the newest one and the say that those definitions are for legacy projects in stm32f10x.h which I verified is true so I included in the file with the definition problem by doing this

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"

and still is giving me those error, I'm new to this so right now I don't have any idea of what to do make those errors disappear.

Previous to ask this question I tried to copy those definitions inside the header of the file with definition problems, after compiled it then said that there are several definitions of the same type and gives me a warning or an error (I don't remember), to me this means that the compiler is seeing the file stm32f10x.h but for some unknown reason is not getting the definitions to make it work.

How can this problem be solved?. I'm blocked here right now.


2 Answers 2


Look at the top of stm32f10x.h and you'll see that you can choose which chip you have based on a few defines.
Pick the right one and then add this as define in the compiler options.

  • \$\begingroup\$ I did uncomment the line #define STM32F10X_MD /*!< STM32F10X_MD: STM32 Medium density devices /, now it gives me the warnings like the following: ./stm32f10x.h(260): warning: declaration shadows a variable in the global scope [-Wshadow] CAN1_RX1_IRQn = 21, /!< CAN1 RX1 Interrupt / ^ ./stm32f10x.h(189): note: previous declaration is here CAN1_RX1_IRQn = 21, /!< CAN1 RX1 Interrupt */ \$\endgroup\$
    – vram
    Commented Jun 25, 2020 at 19:36
  • \$\begingroup\$ and errors like the following: ./stm32f10x.h(260): error: redefinition of enumerator 'CAN1_RX1_IRQn' CAN1_RX1_IRQn = 21, /*!< CAN1 RX1 Interrupt / ^ ./stm32f10x.h(189): note: previous definition is here CAN1_RX1_IRQn = 21, /!< CAN1 RX1 Interrupt */ \$\endgroup\$
    – vram
    Commented Jun 25, 2020 at 19:37
  • \$\begingroup\$ if you se the both references in the warnings and/or errors points to the same file, like if bothe declarations where in the same file. So, I'm still blocked. \$\endgroup\$
    – vram
    Commented Jun 25, 2020 at 19:40
  • \$\begingroup\$ I've noted that the last erros and warnings was caused because the peripheral library has its own system declarations and CMSIS has the same declarations, the compiler sees both and it gave me those messages, I've conclude that I not must mix the peripheral library with CMSIS, \$\endgroup\$
    – vram
    Commented Jun 25, 2020 at 23:53

The real reason of all this problem was that by the moment I didn't install the library for the specific part thorugh the pack installer then the Manage Run-time environment, after that I had to fight some more but right now is isn't giving me errors.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.