I solved this problem. The reason for this is because main ardunioArduino is c++ and simplesample_mqtt.c is c code and we have to use c++ code in c code :
iIn main ardunioArduino file you have to declare function like this :
extern "C" void TurnOn();
void TurnOn()
{
digitalWrite(RELAY_SONOFF, HIGH);
digitalWrite(LED_SONOFF, HIGH);
}
extern "C" void TurnOn();
void TurnOn()
{
digitalWrite(RELAY_SONOFF, HIGH);
digitalWrite(LED_SONOFF, HIGH);
}
and use this function in c code :
void TurnOn(); EXECUTE_COMMAND_RESULT TurnOn(ContosoAnemometer* device) { (void)device; TurnOn(); (void)printf("Turning fan on.\r\n"); return EXECUTE_COMMAND_SUCCESS; }
void TurnOn();
EXECUTE_COMMAND_RESULT TurnOn(ContosoAnemometer* device)
{
(void)device;
TurnOn();
(void)printf("Turning fan on.\r\n");
return EXECUTE_COMMAND_SUCCESS;
}