This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C++ on the TM4C123 using CCS

Hello,

When using CCS for the TM4C platform, how do we use cpp?

I understand CCS compiles cpp files with c++, but how can we make a .h file be compiled with c++?

I have combined the .h files .cpp file to make a single .cpp file, that contains the .h file in the top, this way it compiles without errors.

Can I put some #ifndef statement inside the .h file to tell the compiler it belongs to a cpp file?

Consider the following code, axon.cpp

#include <stdint.h>

// .h part
class Axon {

    public:
      Axon();
      ~Axon();
      void fire();
      static const uint8_t EXCITATORY = 0;
      static const uint8_t INHIBITORY = 1;

    private:
      uint8_t strength;
      uint8_t type;

};

// .cpp part
Axon::Axon() {}
Axon::~Axon() {}
void Axon::fire() {}