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.

CCS/CCSTUDIO: How to remove _cplusplus region from compilation?

Part Number: CCSTUDIO
Other Parts Discussed in Thread: TMS320F280041

Tool/software: Code Composer Studio

HI there,

Currently i am compiling code for tms320f280041, using example 'HVPM_Sensorless_2833x'. i don't want to compile '_cplusplus' region. how to do that?

Thanks!

  • The screen shot you attached is not visible.  The usual reason is given in this FAQ.

    The preprocessor symbol __cplusplus is predefined by the compiler when C++ code is being compiled.  Here is a typical example of usage in a header file ...

    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /* typical header file code here */
    
    #ifdef __cplusplus
    }
    #endif

    When this header file is included in a C++ source file, it is compiled as C++ code.  In that case, the code inside these two #ifdef blocks is used.  Otherwise, it is ignored.  These two blocks of code apply extern "C" linkage to any functions declared in the header file.

    I presume the code in the missing screen shot does something similar.  

    Thanks and regards,

    -George

  • Dear George,

    As shown in below image, currently only _cpluspluse code gets compiled. so, my question is how to remove that. i want to compile else part. 

    Regards,

    Dhaval

  • I presume these source lines appear in a file with a name that uses the file extension .c.  In typical usage, that means this is compiled as C code and not C++ code.  In that case, the highlighted lines in the screen shot, the lines between #else and #endif, are compiled.  The lines between the #ifdef and the #else are ignored.  Is this what you want?

    Thanks and regards,

    -George

  • Hey George,

    That is exactly what i want. i attached similar image of what i required

    .

    As you said in above image line between #else and #endif are compiled, which i required in my current application. Please suggest me what should i do.

    Thanks & Regards,

    Dhaval

  • This may not be a compiler problem, but a problem with which lines are highlighted by the editor in CCS.  Are these variables going in the sections named by the DATA_SECTION pragma?

    Thanks and regards,

    -George

  • Yes George, that's true. These variables going in the sections named by DATA_SECTION pragma.

    Thanks and regards,

    -Dhaval

  • Then this is not a compiler problem.  It is problem with which lines are highlighted by the editor in CCS.  How much does this problem bother you?

    Thanks and regards,

    -George

  • Due to this problem some registers of ADC modules are not getting defined and code is unable to compile.

    Regards,

    Dhaval

  • That sounds like a problem with the preprocessing step of compilation.  To debug such problems, use the build option --gen_preprocessor_listing.  It creates a file with the same name as the source file, with the extension changed to .rl.  Inspect this file to understand what happens during preprocessing.  For further details, especially the format of the .rl file, please search the C28x compiler manual for the sub-chapter titled Generating a Raw Listing File.

    Thanks and regards,

    -George