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.

TMS320F28388D: Converting project from C to C++

Part Number: TMS320F28388D
Other Parts Discussed in Thread: TMDSCNCD28388D

I am running an example project on the TMDSCNCD28388D Control Card  (with TMS320F28388D microcontroller).

This project is written in C.

How can this be converted to C++? 

Specifically, I want a C++ project but I want to be able to use some of the Texas Instruments files written in C containing functions to set up the GPIO, Interrupts, etc.

What is the best way to convert project to C++ without breaking it?

Thanks.

  • It is possible to mix C and C++ code in the same program.  Keep in mind these tips (not  from TI).  The typical way to tell the compiler whether a source file is C or C++ is by the file extension: .c means C and .cpp means C++.

    Thanks and regards,

    -George

  • Is there any way to just create a C++ program from scratch in Code Composer.

    I don't see any option to do this -- looks like only C projects for TMS320F28388D processor.

  • Is there any way to just create a C++ program from scratch in Code Composer.

    It is only slightly different from creating a project with C source files.  Just name the source files with file extension .cpp instead.

    Thanks and regards,

    -George

  • Used file extension .cpp but still didn't work. Finally got it to work using extern "C" at the top of the .cpp file and then the function prototype for every function in the .cpp file that is called in a C file or for every C function that is called in the .cpp file.

    For example, if

    int func1(void) is a C++ function in the .cpp file called by a C function in a C file and if

    double func2(void) is a C function in a C file called by a C++ function in the .cpp file, then at the top of the .cpp file need to put this:

    extern "C" {
    int func1(void);

    double func2(void);
    };