我正在尝试将esp8266设备连接到azure IOT集线器,据我了解,方法是使用正式的AzureIoThub库(在库管理器中分发),但是为什么包含此库的任何代码都没有编译。
添加库后出现以下错误。
Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Build options changed, rebuilding all
In file included from C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/constbuffer.h:16:0,
from C:\Users\uriya\Documents\Arduino\libraries\AzureIoTHub\src\internal/iothub_client_private.h:9,
from C:\Users\uriya\Documents\Arduino\libraries\AzureIoTHub\src\iothub_client_ll_uploadtoblob.c:20:
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:114:30: error: pasting "MOCKABLE_" and "/*this creates a new constbuffer from a memory area*/" does not give a valid preprocessing token
#define EXPAND_PROD_ENTRY(A) MOCKABLE_##A
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:9069:1: note: in expansion of macro 'EXPAND_PROD_ENTRY'
X(P1) \
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:8585:21: note: in expansion of macro 'MU_FOR_EACH_1_9'
#define MU_C2_(x,y) x##y
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:119:5: note: in expansion of macro 'MU_FOR_EACH_1'
MU_FOR_EACH_1(EXPAND_PROD_ENTRY, __VA_ARGS__)
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/constbuffer.h:35:1: note: in expansion of macro 'MOCKABLE_INTERFACE'
MOCKABLE_INTERFACE(constbuffer,
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:114:30: error: pasting "MOCKABLE_" and "/*this creates a new constbuffer from an existing BUFFER_HANDLE*/" does not give a valid preprocessing token
#define EXPAND_PROD_ENTRY(A) MOCKABLE_##A
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:9073:1: note: in expansion of macro 'EXPAND_PROD_ENTRY'
X(P1) \
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:9070:1: note: in expansion of macro 'MU_FOR_EACH_1_8'
MU_FOR_EACH_1_8(X, P2, P3, P4, P5, P6, P7, P8, P9)
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:8585:21: note: in expansion of macro 'MU_FOR_EACH_1_9'
#define MU_C2_(x,y) x##y
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:119:5: note: in expansion of macro 'MU_FOR_EACH_1'
MU_FOR_EACH_1(EXPAND_PROD_ENTRY, __VA_ARGS__)
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/constbuffer.h:35:1: note: in expansion of macro 'MOCKABLE_INTERFACE'
MOCKABLE_INTERFACE(constbuffer,
^
C:\Users\uriya\Documents\Arduino\libraries\AzureIoTHub\src\iothub_client_ll_uploadtoblob.c:26:27: fatal error: internal/blob.h: No such file or directory
#include "internal/blob.h"
^
compilation terminated.
exit status 1
Error compiling for board Generic ESP8266 Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
任何建议或评论都会极大地帮助我
答案 0 :(得分:0)
答案 1 :(得分:0)
您可能遇到以下类似问题: https://github.com/arduino/Arduino/issues/7930
原来是固定于arduino-builder的: https://github.com/arduino/arduino-builder/pull/285
答案 2 :(得分:0)
This post可能是解决方案。
基本上编辑.\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\platform.txt
,使其具有以下行:
build.extra_flags=-DESP8266 -DDONT_USE_UPLOADTOBLOB -DUSE_BALTIMORE_CERT
答案 3 :(得分:0)
在build.extra_flags=
前一行的文件platform.txt中有一个重要提示:
#可以在boards.txt中覆盖
使用通用8266板,我必须按如下所示修改文件board.txt中的build.extra_flag才能编译Azure示例:
generic.menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -DDONT_USE_UPLOADTOBLOB -DUSE_BALTIMORE_CERT