how to include C code in C++ and the opposite?
I have a problem that I cannot include C code in C++ and the opposite. Different sites suggest to solve this problem by including the header file of C in the header file of C++ (Model.hpp) like:
#ifdef __cplusplus
extern "C"{
#endif
#include "coreTransferBufferAPI.h"
#ifdef __cplusplus
}
#endif
In the code file Model.cpp, I try to use a function called (CB_Display_GetValues(&values) from this header.
CB_DisplayValues_t is also defined in this header, but doesn't show any errors.
float Model::getTempValue()
{
CB_DisplayValues_t values;
if(CB_Display_GetValues(&values)==REPORT_OK)
{
return values.cellTemperature;
}
return NULL;
}
The call of the function (CB_Display_GetValues(&values)) gives an undefined reference error:
/../TouchGFX/gui/src/model/Model.cpp:32: undefined reference to `CB_Display_GetValues'
Do you have a solution for this problem or do you know how to solve it? How would including a C++ code in C work (opposite way)?
Thank you very much and a festive holiday, K.Frey1
