ESP8266使用smartconfig编译不通过undefined reference

1、问题现象

最近学习ESP8266的smartconfig功能,写了个测试代码在user_main文件中,结果编译时报错

/mnt/Share/ESP8266_NOS_T/app/user/user_main.c:205: undefined reference to `smartconfig_set_type'   
/mnt/Share/ESP8266_NOS_T/app/user/user_main.c:206: undefined reference to `smartconfig_start'
/mnt/Share/ESP8266_NOS_T/app/user/user_main.c:211: undefined reference to `smartconfig_stop'  
/mnt/Share/ESP8266_NOS_T/app/user/user_main.c:180: undefined reference to `smartconfig_stop'    

2、查找原因

检查头文件包含情况 ,这几个函数在smartconfig.h中声明,在libsmartconfig.a中封装。刚开始怀疑是包含层次出了问题,检查后发现不存在包含层次问题。
这个问题困扰了几天,知道肯定是makefile出的问题,但是不知道如何下手,后来想到了他的example里面不是有smartconfig例子么,就打开看了下readme就知道问题原因了,里面有这么句:

if you want to use AIRKISS2.0 LAN discovery, should include airkiss.h and include libairkiss.a in makefile   

然后打开他的makefile看了下:

LINKFLAGS_eagle.app.v6 = \
-L../lib        \
-nostdlib	\
-T$(LD_FILE)   \
-Wl,--no-check-sections	\
-Wl,--gc-sections	\
-u call_user_start	\
-Wl,-static						\
-Wl,--start-group					\
-lc					\
-lgcc					\
-lhal					\
-lphy	\
-lpp	\
-lnet80211	\
-llwip	\
-lwpa	\
-lcrypto	\
-lmain	\
-ljson	\
-lssl	\
-lupgrade	\
-lsmartconfig \
-lairkiss\
$(DEP_LIBS_eagle.app.v6)					\
-Wl,--end-group

果然里面有lsmartconfig这个包含进去了,果断修改后,问题解决了,主要还是自己对makefile的编译链接过程不是全明白,因此下决心学习makefile

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值