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.

Compiler/TM4C123GH6PM: C++ Headers not being interpreted as C++

Part Number: TM4C123GH6PM

Tool/software: TI C/C++ Compiler

For any header file I have associated to a C++ source file, the contents of it appear to be interpreted by the compiler as standard C.  At first, it would just fail to resolve any C++ include directive (e.g. #include <map>), but once I removed all of those and placed them directly in the C++ source file, the next error would appear... For example:

error #20: identifier "class" is undefined

So, it's pretty clear that the TI compiler is not figuring out that my header files are for C++ and not standard C. How do you fix this?

  • A header file is compiled the same as the source file which includes it.  By default, a source file is interpreted according to it's file extension.  In typical usage, .c means a C file and .cpp means a C++ file.  For all the details, please search the TI ARM compiler manual for the sub-chapter titled Specifying Filenames.

    Thanks and regards,

    -George