打印
[C语言]

用Keil-MDK built 工程时C文件被多次编译?

[复制链接]
9773|8
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
拨云人|  楼主 | 2013-10-31 17:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我用 Keil-MDK 搭建好了一个工程,在Built的时候发现很多C文件被多次的编译,虽然最终没有产生错误,但是感觉应该是我代码或者软件设置的问题。请高手指教!
Build target 'nrf51822_xxaa (256K)'
Clean started - Project: 'spi_master_example'
   deleting intermediate output files for target 'nrf51822_xxaa (256K)'
assembling arm_startup_nrf51.s...
compiling system_nrf51.c...
compiling FAT.c...
SDcard_driver\FAT.h(154): warning:  #1-D: last line of file ends without a newline
SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
compiling SDcard_driver.c...
SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
compiling main.c...
.\SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
.\SDcard_driver\FAT.h(154): warning:  #1-D: last line of file ends without a newline
compiling nrf51_spi.c...
compiling simple_uart.c...
compiling nrf_delay.c...
linking...
Program Size: Code=4692 RO-data=208 RW-data=1728 ZI-data=3232  
".\_build\spi_master_example_arm.axf" - 0 Errors, 5 Warning(s).

*** Performing Cross-Module-Optimization:
compiling system_nrf51.c...
compiling FAT.c...
SDcard_driver\FAT.h(154): warning:  #1-D: last line of file ends without a newline
SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
compiling SDcard_driver.c...
SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
compiling main.c...
.\SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
.\SDcard_driver\FAT.h(154): warning:  #1-D: last line of file ends without a newline
compiling nrf51_spi.c...
compiling simple_uart.c...
compiling nrf_delay.c...
linking...
Program Size: Code=4296 RO-data=208 RW-data=1728 ZI-data=3232  
compiling system_nrf51.c...
compiling FAT.c...
SDcard_driver\FAT.h(154): warning:  #1-D: last line of file ends without a newline
SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
compiling SDcard_driver.c...
SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
compiling main.c...
.\SDcard_driver\SDcard_driver.h(425): warning:  #1-D: last line of file ends without a newline
.\SDcard_driver\FAT.h(154): warning:  #1-D: last line of file ends without a newline
compiling nrf51_spi.c...
compiling simple_uart.c...
compiling nrf_delay.c...
linking...
Program Size: Code=4296 RO-data=208 RW-data=1728 ZI-data=3232  
FromELF: creating hex file...
".\_build\spi_master_example_arm.axf" - 0 Errors, 5 Warning(s).
*** Completed Cross-Module-Optimization after 3 iteration(s).

相关帖子

沙发
拨云人|  楼主 | 2013-10-31 17:31 | 只看该作者
这是我清空 Build output 窗口之后,点击Build 按钮后,产生的提示信息。可以看到很多C文件是被多次的编译了的。有没有什么方法可以解决这个问题,还请大家不吝赐教!

使用特权

评论回复
板凳
ayb_ice| | 2013-11-1 08:15 | 只看该作者
是在优化,所以需要重新编译,不是多次编译

使用特权

评论回复
地板
拨云人|  楼主 | 2013-11-5 20:26 | 只看该作者
这个优化是有必要的吗?我已经把优化等级设为了0 ,怎么每次还要重编译2遍?

使用特权

评论回复
5
ayb_ice| | 2013-11-6 08:14 | 只看该作者
优化级别等于0不等于完全没有优化

使用特权

评论回复
6
xh2008email| | 2013-12-8 20:10 | 只看该作者
ayb_ice 发表于 2013-11-6 08:14
优化级别等于0不等于完全没有优化

那能不能不要它优化,只让编译器编译一次?是设置还是在程序中编程?

使用特权

评论回复
7
ayb_ice| | 2013-12-9 08:16 | 只看该作者
xh2008email 发表于 2013-12-8 20:10
那能不能不要它优化,只让编译器编译一次?是设置还是在程序中编程?

也许不可能吧

编译必须完整,这个完全取决于编译器

使用特权

评论回复
8
chenbb8| | 2013-12-9 09:41 | 只看该作者
LZ取消target的code generation下的use cross-module optimization试下~

使用特权

评论回复
9
雪狐杨| | 2017-4-12 14:55 | 只看该作者
同意楼上,取消target的code generation下的use cross-module optimization后不会再多次编译

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

34

帖子

0

粉丝