Stm32库函数问题

[复制链接]
1650|7
 楼主| entepino 发表于 2013-9-11 09:18 | 显示全部楼层 |阅读模式
我建立了一个文件,global.c,建立一个函数void GPIO_Configuration(void),其中使用了        GPIO_Init(GPIOB, &GPIO_t)函数,此函数原型在stm32f10x_gpio.c中,声明在stm32f10x_gpio.h中,为何我在global.c中没有include " stm32f10x_gpio.h ",此时程序能够正常编译通过,且运行正常,我就奇怪,没有#include " stm32f10x_gpio.h ",那编译器是怎么找到GPIO_Init(GPIOB, &GPIO_t)这个函数的?是不是库中自带的函数就不用include?
IJK 发表于 2013-9-11 09:25 | 显示全部楼层
如果包含了stm32f10x.h,或者包含了stm32f10x_conf.h,那么stm32f10x_gpio.h就会被包含进去
 楼主| entepino 发表于 2013-9-11 13:26 | 显示全部楼层
确实include “stm32f10x.h”文件,但我在stm32f10x.h文件中没有看见GPIO_Init(GPIOB, &GPIO_t)这个函数的声明啊,那编译器是怎么找到这个函数的咧?
wxweipot 发表于 2013-9-11 16:16 | 显示全部楼层
lz再看看,有的,从下往上看看
#ifdef USE_STDPERIPH_DRIVER
  #include "stm32f10x_conf.h"
#endif
 楼主| entepino 发表于 2013-9-11 17:21 | 显示全部楼层
wxweipot 发表于 2013-9-11 16:16
lz再看看,有的,从下往上看看
#ifdef USE_STDPERIPH_DRIVER
  #include "stm32f10x_conf.h"

是有这样一句,但问题是为何include“stm32f10x.h”或include“stm32f10x_conf.h”,stm32f10x_gpio.h就会被包含进去?why?在stm32f10x.h文件中,也没有include“stm32f10x_gpio.h”这样的语句?!请问,为什么?
cjhk 发表于 2013-9-11 19:03 | 显示全部楼层
不是很了解这一块   以前没有遇到过   楼主   帮你顶一个   看看别人的意见如何
wxweipot 发表于 2013-9-12 09:57 | 显示全部楼层
entepino 发表于 2013-9-11 17:21
是有这样一句,但问题是为何include“stm32f10x.h”或include“stm32f10x_conf.h”,stm32f10x_gpio.h就 ...

stm32f10x_conf.h里面有包含啊。难道lz的库文件不一样,没有包含也会报错的嘛。
 楼主| entepino 发表于 2013-9-15 15:42 | 显示全部楼层
wxweipot 发表于 2013-9-12 09:57
stm32f10x_conf.h里面有包含啊。难道lz的库文件不一样,没有包含也会报错的嘛。 ...

应该是没有
您需要登录后才可以回帖 登录 | 注册

本版积分规则

214

主题

653

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部