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.

C2000-DIGITAL-CONTROL-LIBRARY: complex.h getting error in C++

Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hi,

I found myself in the same situation as the related question above. Trying to compile a source file including DCL.h in c++.

The suggested workaround was to modify the DCL, removing the use of complex type. I don't find it as a good Idea, since I always try to keep link to the newest version of C2000Ware, which will overwrite the changes with each update.

Are you working on a permanent solution for that, as Han said in the old question?

Kind Regards

Agustin J. Gomez

  • I found the c2000 repository in github and did a fork to link my projects to. I just changed the part of the library that I use.

    Here the changes:

    DCL c++ compatibility: remove complex.h and zpk. Switch pragmas · agustinjgomez/c2000ware-core-sdk@0945fd3

    Just for your information, I was trying to compile the code in another environment, that is, my host, a linux with its gcc version. I compile with c++98 flag and the only issue is the use of "complex" type, but there is no warning as in the  implementation of TI for c28x. They just undef "complex". Then if I just change the code of DCL to use "_Complex" instead of its alias "complex" it just works there.

  • Hi Agustin,

    Thank you for arising this concern, yes the complex types are inherentently different between c and c++. C++ now recommends the use of std::complex, whereas the complex in C expands to _Complex keyword.  Your suggestion is valid, but nonetheless I believe #pragma CODE_SECTION() is only recognized by C28x compiler and not gcc, and DCL is optimized for C28x compiler with a host of C28x assembly funcs.

    Whilst I couldn't make DCL compiler-agnostic, I could make some changes like you suggested to the DCL to ensure compatbilities across c and c++. Nonetheless, it wouldn't be reflected in C2000Ware until 1Q25.

    Best,

    Sen Wang

  • Hi Sen, 

    Thanks for your answer. It would be nice to have the compliance with C++. 

    The idea of compiling for the host, and not the target, it just to allow testing without the target, maybe in the cloud. But you don't have to worry about that. 

    I can wrap the library, fake some dependencies and/or use the define " __TMS320C28XX__ " to make it compile

    Best Regards

    Agustin J. Gomez