I followed the guide "Cross Domain Development Kit XDK110 Platform for Application Development", however SUCCESS, FAILURE couldn't be resolved in MQTTClient.c.

Any solution to it? teh workbench ver is  v2.0.0

Best Rgds.

Ms. Zhu

0 (0 Votes)
RE: SUCCESS, FAILURE couldn't be resolved in MQTTClient.c
Answer
5/10/17 12:58 PM as a reply to Bochun Zhu.

Hello Bochun,

this issue occurs, because the marked variable is not uniquely  namely declared and therefore the linker of the XDK Workbench finds references to SUCCESS and FAILURE in other interfaces and implementation files, in which a variable with the same name is declared. Therefore the error symbol cannot be resolved appears.

But this happens only, because the linker is unable to resolve the variable. If the compiler of the XDK Workbench can build the project without errors, then the project should work without issues on the XDK.

There are three options available to solve this.
Option one would be to define the two unresolvable variables in the header file MQTTClient.h in the following pattern and to delete them in the enumeration returnCode.

#define SUCCESS 0
#define FAILURE -1

Option two would be to move the complete returnCode enumeration to the beginning of the implementation file MQTTClient.c beneath #include "MQTTClient.h".

And the last option would be to rename both variables to unique names, so that the linker won't find any similar variable references in other files.
In this case, you will have to rename them in the header MQTTClient.h as well as in the MQTTClient.c. The XDK Workbench offers the possibility of quick refactoring, by rightclicking the variable name, selecting Refactor > Rename, and typing a new name.

Please tell me if this is helpful and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 Votes)
RE: SUCCESS, FAILURE couldn't be resolved in MQTTClient.c
Answer
5/13/17 3:18 AM as a reply to Franjo Stjepandic.

Thank you Franjo,

After using option 2, the error for SUCCESS and FAILURE gone. But build project still encounter problems:

1. Under Console window:

Makefile:50: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2 

2. Under Problems window:

A) make\mingw32-make.exe[1]: *** No rule to make target 'C:/XDK-Workbench1_5_2/workspace/MQTT_Paho_RELEASEv0.1.1/debug/objects/paho/MQTTClient.o', needed by 'C:/XDK-Workbench1_5_2/workspace/MQTT_Paho_RELEASEv0.1.1/debug/XDK_PAHO_DEMO.out'.  Stop. MQTT_Paho_RELEASEv0.1.1 C/C++ Problem:

B) make\mingw32-make.exe[1]: *** Waiting for unfinished jobs....    MQTT_Paho_RELEASEv0.1.1 C/C++ Problem

C) mingw32-make: *** [debug] Error 2 MQTT_Paho_RELEASEv0.1.1 C/C++ Problem

D) recipe for target 'debug' failed    Makefile /MQTT_Paho_RELEASEv0.1.1 line 50 C/C++ Problem

Appreciated any advice in advance!

Ms. Zhu

0 (0 Votes)
RE: SUCCESS, FAILURE couldn't be resolved in MQTTClient.c
Answer
5/13/17 11:50 PM as a reply to Bochun Zhu.
SUCCESS, FAILURE aolved. Thanks. Makefile issue to be posted in a separate thread.
0 (0 Votes)
RE: SUCCESS, FAILURE couldn't be resolved in MQTTClient.c
Answer
5/15/17 5:00 PM as a reply to Bochun Zhu.

Hello Bochun,

I am glad to hear that you were able to solve the issue.

I will reply to the makefile issue in this thread.

Please do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 Votes)