*** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Rebuild target 'STM324F_GPIO' assembling startup_stm32f40xx.s... compiling misc.c... compiling stm32f4xx_gpio.c... compiling stm32f4xx_rcc.c... compiling main.c... User\main.c(7): error: #268: declaration may not appear after executable statement in block GPIO_InitTypeDef GPIO_InitDef; User\main.c(7): error: #67: expected a "}" GPIO_InitTypeDef GPIO_InitDef; User\main.c(8): error: #79: expected a type specifier RCC_AHB1PeriphClockCmd( CC_AHB1Periph_GPIOD, ENABLE); User\main.c(8): error: #757: constant "ENABLE" is not a type name RCC_AHB1PeriphClockCmd( CC_AHB1Periph_GPIOD, ENABLE); User\main.c(8): warning: #77-D: this declaration has no storage class or type specifier RCC_AHB1PeriphClockCmd( CC_AHB1Periph_GPIOD, ENABLE); User\main.c(8): error: #147: declaration is incompatible with "void RCC_AHB1PeriphClockCmd(uint32_t, FunctionalState)" (declared at line 983 of "..\Libraries\STM32F4xx_StdPeriph_Driver\inc\stm32f4xx_rcc.h") RCC_AHB1PeriphClockCmd( CC_AHB1Periph_GPIOD, ENABLE); User\main.c(10): error: #77-D: this declaration has no storage class or type specifier GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; User\main.c(10): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitDef" (declared at line 7) GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; User\main.c(10): error: #65: expected a ";" GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; User\main.c(11): error: #77-D: this declaration has no storage class or type specifier GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; User\main.c(11): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitDef" (declared at line 10) GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; User\main.c(11): error: #65: expected a ";" GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; User\main.c(12): error: #77-D: this declaration has no storage class or type specifier GPIO_InitDef.GPIO_OType = GPIO_OType_PP; User\main.c(12): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitDef" (declared at line 11) GPIO_InitDef.GPIO_OType = GPIO_OType_PP; User\main.c(12): error: #65: expected a ";" GPIO_InitDef.GPIO_OType = GPIO_OType_PP; User\main.c(13): error: #77-D: this declaration has no storage class or type specifier GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; User\main.c(13): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitDef" (declared at line 12) GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; User\main.c(13): error: #65: expected a ";" GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; User\main.c(14): error: #77-D: this declaration has no storage class or type specifier GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz; User\main.c(14): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitDef" (declared at line 13) GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz; User\main.c(14): error: #65: expected a ";" GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz; User\main.c(16): error: #79: expected a type specifier GPIO_Init( PIOD, &GPIO_InitDef); User\main.c(16): error: #79: expected a type specifier GPIO_Init( PIOD, &GPIO_InitDef); User\main.c(16): warning: #77-D: this declaration has no storage class or type specifier GPIO_Init( PIOD, &GPIO_InitDef); User\main.c(16): error: #147: declaration is incompatible with "void GPIO_Init(GPIO_TypeDef *, GPIO_InitTypeDef *)" (declared at line 560 of "..\Libraries\STM32F4xx_StdPeriph_Driver\inc\stm32f4xx_gpio.h") GPIO_Init( PIOD, &GPIO_InitDef); User\main.c(18): error: #79: expected a type specifier RCC_AHB1PeriphClockCmd( CC_AHB1Periph_GPIOA, ENABLE); User\main.c(18): error: #757: constant "ENABLE" is not a type name RCC_AHB1PeriphClockCmd( CC_AHB1Periph_GPIOA, ENABLE); User\main.c(18): warning: #77-D: this declaration has no storage class or type specifier RCC_AHB1PeriphClockCmd( CC_AHB1Periph_GPIOA, ENABLE); User\main.c(20): error: #77-D: this declaration has no storage class or type specifier GPIO_InitDef.GPIO_Pin = GPIO_Pin_0; User\main.c(20): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitDef" (declared at line 14) GPIO_InitDef.GPIO_Pin = GPIO_Pin_0; User\main.c(20): error: #65: expected a ";" GPIO_InitDef.GPIO_Pin = GPIO_Pin_0; User\main.c(21): error: #77-D: this declaration has no storage class or type specifier GPIO_InitDef.GPIO_Mode = GPIO_Mode_IN; User\main.c(21): error: #147: declaration is incompatible with "GPIO_InitTypeDef GPIO_InitDef" (declared at line 20) GPIO_InitDef.GPIO_Mode = GPIO_Mode_IN; User\main.c: 3 warnings, 30 errors compiling system_stm32f4xx.c... ".\Target\GPIO\GPIO.axf" - 30 Error(s), 3 Warning(s). Target not created. Build Time Elapsed: 00:00:06
The thing to do when you get huge numbers of errors like this is to start with the first one - because that first error will very likely be the cause of many (if not all) of the following errors.
So - start here:
User\main.c(7): error: #268: declaration may not appear after executable statement in block GPIO_InitTypeDef GPIO_InitDef;
Note that:
User\main.c tells you which file the error was found in;
(7) tells you which line in that file the error was found on.
So open that file, go to that line, and fix the error.
(You should be able to double-click the message in the output window to go straight to the offending line).