OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6276|回复: 8

原子哥的源程序在keil5下编译报错

[复制链接]

4

主题

20

帖子

0

精华

初级会员

Rank: 2

积分
67
金钱
67
注册时间
2015-1-12
在线时间
4 小时
发表于 2016-1-4 19:44:50 | 显示全部楼层 |阅读模式
1金钱
原子哥的源程序,没有任何改动,我在keil mdk5下打开的时候,编译,显示通过。然后,我改了一下设备,将ZE改成了C8或者CB,就出现了编译错误。请问需要怎么改动设备啊。


compiling main.c...
stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
main.c: 1 warning, 1 error
compiling stm32f10x_it.c...
stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
stm32f10x_it.c: 1 warning, 1 error
compiling system_stm32f10x.c...
stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
system_stm32f10x.c: 1 warning, 1 error
compiling misc.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\misc.c: 1 warning, 1 error
compiling stm32f10x_adc.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_adc.c: 1 warning, 1 error
compiling stm32f10x_bkp.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_bkp.c: 1 warning, 1 error
compiling stm32f10x_can.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_can.c: 1 warning, 1 error
compiling stm32f10x_cec.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_cec.c: 1 warning, 1 error
compiling stm32f10x_crc.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_crc.c: 1 warning, 1 error
compiling stm32f10x_dac.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_dac.c: 1 warning, 1 error
compiling stm32f10x_dbgmcu.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_dbgmcu.c: 1 warning, 1 error
compiling stm32f10x_dma.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_dma.c: 1 warning, 1 error
compiling stm32f10x_exti.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_exti.c: 1 warning, 1 error
compiling stm32f10x_flash.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_flash.c: 1 warning, 1 error
compiling stm32f10x_fsmc.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_fsmc.c: 1 warning, 1 error
compiling stm32f10x_gpio.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_gpio.c: 1 warning, 1 error
compiling stm32f10x_i2c.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_i2c.c: 1 warning, 1 error
compiling stm32f10x_iwdg.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_iwdg.c: 1 warning, 1 error
compiling stm32f10x_pwr.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_pwr.c: 1 warning, 1 error
compiling stm32f10x_rcc.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_rcc.c: 1 warning, 1 error
compiling stm32f10x_rtc.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_rtc.c: 1 warning, 1 error
compiling stm32f10x_sdio.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_sdio.c: 1 warning, 1 error
compiling stm32f10x_spi.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_spi.c: 1 warning, 1 error
compiling stm32f10x_tim.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_tim.c: 1 warning, 1 error
compiling stm32f10x_usart.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_usart.c: 1 warning, 1 error
compiling stm32f10x_wwdg.c...
..\user\stm32f10x.h(298): error:  #67: expected a "}"
    ADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */
..\user\stm32f10x.h(472): warning:  #12-D: parsing restarts here after previous syntax error
  } IRQn_Type;
..\fwlib\src\stm32f10x_wwdg.c: 1 warning, 1 error
compiling core_cm3.c...
assembling startup_stm32f10x_md.s...
"..\obj\templete11.axf" - 26 Error(s), 26 Warning(s).
Target not created

最佳答案

查看完整内容[请看2#楼]

解决方法,在keil4中不会遇到的问题,在keil5下面,由于define等原因,会造成符号报错。两种方法解决。 1. 直接删掉C/C++中define里面对芯片的定义 2. 选择正确的启动文件(大容量的启动文件对低容量的芯片是兼容的,所以,在芯片型号从大容量改成低容量的时候,可以直接用第一种方法)
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

4

主题

20

帖子

0

精华

初级会员

Rank: 2

积分
67
金钱
67
注册时间
2015-1-12
在线时间
4 小时
 楼主| 发表于 2016-1-4 19:44:51 | 显示全部楼层
解决方法,在keil4中不会遇到的问题,在keil5下面,由于define等原因,会造成符号报错。两种方法解决。
1. 直接删掉C/C++中define里面对芯片的定义
2. 选择正确的启动文件(大容量的启动文件对低容量的芯片是兼容的,所以,在芯片型号从大容量改成低容量的时候,可以直接用第一种方法)
回复

使用道具 举报

70

主题

6761

帖子

0

精华

论坛大神

Rank: 7Rank: 7Rank: 7

积分
13118
金钱
13118
注册时间
2012-11-26
在线时间
3813 小时
发表于 2016-1-4 20:09:39 | 显示全部楼层
FLASH的容量不同

说句实话,虽然难听,但是真的很烦不会爬,就跑,出了问题,还直接伸手的
学无止境
回复

使用道具 举报

120

主题

7878

帖子

13

精华

资深版主

Rank: 8Rank: 8

积分
12012
金钱
12012
注册时间
2013-9-10
在线时间
427 小时
发表于 2016-1-4 20:22:25 | 显示全部楼层
启动文件也要改
回复

使用道具 举报

4

主题

20

帖子

0

精华

初级会员

Rank: 2

积分
67
金钱
67
注册时间
2015-1-12
在线时间
4 小时
 楼主| 发表于 2016-1-4 20:29:29 | 显示全部楼层
jermy_z 发表于 2016-1-4 20:09
FLASH的容量不同

说句实话,虽然难听,但是真的很烦不会爬,就跑,出了问题,还直接伸手的

真是潇洒,我想你可能只知其一不知其二吧,试着在keil4下编译试试,keil4是会忽略内存大小这个问题直接通过的。
我也不想说什么,至于我是该爬还是该跑,我自有我自己的定位。
回复

使用道具 举报

70

主题

6761

帖子

0

精华

论坛大神

Rank: 7Rank: 7Rank: 7

积分
13118
金钱
13118
注册时间
2012-11-26
在线时间
3813 小时
发表于 2016-1-4 22:05:30 | 显示全部楼层
StarFlying 发表于 2016-1-4 20:29
真是潇洒,我想你可能只知其一不知其二吧,试着在keil4下编译试试,keil4是会忽略内存大小这个问题直接通 ...

呵呵      。
学无止境
回复

使用道具 举报

3

主题

130

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
373
金钱
373
注册时间
2015-3-7
在线时间
43 小时
发表于 2016-1-5 07:48:25 | 显示全部楼层
芯片的容量不同,对应的外设也不一样。低容量的芯片有些外设是没有的,所以你直接修改了芯片型号对应的启动文件也需要修改。程序里有些外设也需要修改~
为人莫作千年计,三十河东四十西,莫欺少年穷。
回复

使用道具 举报

0

主题

3

帖子

0

精华

初级会员

Rank: 2

积分
69
金钱
69
注册时间
2015-12-25
在线时间
13 小时
发表于 2016-4-20 09:29:43 | 显示全部楼层
jermy_z 发表于 2016-1-4 20:09
FLASH的容量不同

说句实话,虽然难听,但是真的很烦不会爬,就跑,出了问题,还直接伸手的

道不同,不相与为谋
回复

使用道具 举报

10

主题

62

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
417
金钱
417
注册时间
2014-12-10
在线时间
46 小时
发表于 2016-6-20 16:47:30 | 显示全部楼层

请问启动文件如何换,要换怎样的?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-10 13:38

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表