这些错误是什么意思?在生成 Kaa SDK 并运行它之后,我正在遵循指南,但我遇到了这些错误。
/home/pi/labsdk-RP/client/c/src/kaa_demo.c: In function ‘main’:
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:145:5: error: parameter ‘ret’ is initialized
int ret = target_initialize();
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:146:5: error: expected declaration specifiers before ‘if’
if (ret < 0) {
^
In file included from /home/pi/labsdk-RP/client/c/src/kaa_demo.c:20:0:
/home/pi/labsdk-RP/client/c/targets/posix/target.h:34:31: error: expected declaration specifiers before ‘printf’
#define demo_printf(msg, ...) printf((msg), ##__VA_ARGS__)
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:152:5: note: in expansion of macro ‘demo_printf’
demo_printf("Data collection demo started\r\n");
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:157:5: error: parameter ‘kaa_client’ is initialized
kaa_client_t *kaa_client = NULL;
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:158:5: error: parameter ‘error’ is initialized
kaa_error_t error = kaa_client_create(&kaa_client, NULL);
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:160:5: error: expected declaration specifiers before ‘if’
if (error) {
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:166:5: error: expected declaration specifiers before ‘sensor_context’
sensor_context.kaa_client = kaa_client;
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:167:5: error: parameter ‘receiver’ is initialized
kaa_configuration_root_receiver_t receiver = {
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:172:5: error: expected declaration specifiers before ‘error’
error = kaa_configuration_manager_set_root_receiver(
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:176:5: error: expected declaration specifiers before ‘if’
if (error) {
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:181:5: error: parameter ‘default_configuration’ is initialized
const kaa_configuration_empty_data_t *default_configuration =
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:184:5: error: expected declaration specifiers before ‘sensor_context’
sensor_context.sample_period = default_configuration->sample_period;
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:185:5: error: expected declaration specifiers before ‘sensor_context’
sensor_context.last_upload_time = time(NULL);
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:187:5: error: parameter ‘log_upload_strategy_context’ is initialized
void *log_upload_strategy_context = NULL;
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:188:5: error: expected declaration specifiers before ‘error’
error = ext_log_upload_strategy_create(kaa_client_get_context(kaa_client),
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:191:5: error: expected declaration specifiers before ‘if’
if (error) {
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:196:5: error: expected declaration specifiers before ‘error’
error = ext_log_upload_strategy_set_threshold_count(log_upload_strategy_context,
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:199:5: error: expected declaration specifiers before ‘if’
if (error) {
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:204:5: error: expected declaration specifiers before ‘error’
error = kaa_logging_set_strategy(kaa_client_get_context(kaa_client)->log_collector,
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:207:5: error: expected declaration specifiers before ‘if’
if (error) {
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:215:5: error: expected declaration specifiers before ‘error’
error = kaa_client_start(kaa_client, temperature_update,
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:218:5: error: expected declaration specifiers before ‘if’
if (error) {
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:226:5: error: expected declaration specifiers before ‘kaa_client_destroy’
kaa_client_destroy(kaa_client);
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:228:5: error: expected declaration specifiers before ‘return’
return EXIT_SUCCESS;
^
/home/pi/labsdk-RP/client/c/src/kaa_demo.c:229:1: error: expected declaration specifiers before ‘}’ token
预期声明是什么意思?我应该做某种形式的声明吗?原始演示代码运行良好。下面是 kaa_demo.c 的代码: