AnsweredAssumed Answered

Compiler reports error when inlining a static C++ function that returns a value.

Question asked by oldfoxsoftware on Nov 3, 2016
Latest reply on Dec 5, 2016 by Kader.M
class CommUtils {
public:
     static inline void SwapBytes(const unsigned char *source, const unsigned len);
     static int ToBigEndianInt(unsigned char *buffer);
// Generates an error when adding "inline":
// cc0114:  error: function "CommUtils::ToBigEndianFloat" was referenced but not defined
     static float ToBigEndianFloat(unsigned char *buffer);
// Does not generate an error when function does not return a value.
     static inline void ToBigEndian(float *value);
     static inline void ToBigEndian(int *value);
};

     float buffer[SPI_BUFFER_MAX];
     for (unsigned i = 0; i < count; i++)
          buffer[i] = CommUtils::ToBigEndianFloat((unsigned char *) &bufferFloat[i]);

Outcomes