Ceedling未能模拟头球

dffbzjpn  于 12个月前  发布在  其他
关注(0)|答案(2)|浏览(123)

我试图模仿一个头,这是由一个源文件,我测试包括。
标题开头如下:

#if defined(ICM42600)
#define ICM_WHOAMI ICM42600_WHOAMI
#elif defined(ICM42602)
#define ICM_WHOAMI ICM42602_WHOAMI
#elif defined(ICM42605)
#define ICM_WHOAMI ICM42605_WHOAMI
#elif defined(ICM42622)
#define ICM_WHOAMI ICM42622_WHOAMI
#elif defined(ICM42686)
#define ICM_WHOAMI ICM42686_WHOAMI
#elif defined(ICM42688)
#define ICM_WHOAMI ICM42688_WHOAMI
#elif defined(ICM42608)
#define ICM_WHOAMI ICM42608_WHOAMI
#elif defined(IIM42623)
#define ICM_WHOAMI IIM42623_WHOAMI
#elif defined(IIM42624)
#define ICM_WHOAMI IIM42624_WHOAMI
#elif defined(IIM42625)
#define ICM_WHOAMI IIM42625_WHOAMI
#elif defined(ICM40608)
#define ICM_WHOAMI ICM40608_WHOAMI
#else
#error "Please define which ICM variant is targeted. Possible values: ICM42600, ICM42602, ICM42605, ICM42686, ICM42688, ICM42622, ICM42608, ICM4068"
#endif

字符串
我试着这样嘲笑它:

#define ICM42600 1
#include "mock_Icm426xxDefs.h"


然而,当我尝试运行ceedling测试时,我总是得到以下错误:

----------------------------
Generating include list for Icm426xxDefs.h...
build/temp/_Icm426xxDefs.h:74:2: error: #error "Please define which ICM variant is targeted. Possible values: ICM42600, ICM42602, ICM42605, ICM42686, ICM42688, ICM42622, ICM42608, ICM4068"
 #error "Please define which ICM variant is targeted. Possible values: ICM42600, ICM42602, ICM42605, ICM42686, ICM42688, ICM42622, ICM42608, ICM4068"
  ^~~~~


我不知道如何处理这个问题,我的印象是ceedling会自动模拟头,并且没有错误说明我可以做些什么来解决这个问题。

mzsu5hc0

mzsu5hc01#

#error消息的输出意味着没有使用ICM_WHOAMI的任何(其他)定义。
为什么在#include之前的#define没有被看到,这需要您提供的其他信息

pjngdqdw

pjngdqdw2#

我还遇到了一些没有传递给包含文件的定义的问题。尝试将带有选项-D的定义直接传递给编译器和链接器,方法是将它们添加到项目.yml中:
:flags::test::compile:::- -D ICM42600:link:::- -D ICM42600

相关问题