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/TMS320F28069: how to use the standard library for queue

Part Number: TMS320F28069
Other Parts Discussed in Thread: MOTORWARE

Tool/software: Code Composer Studio

I have to use a queue to process commands over DNet messages.

I attemped to use the #include <queue.h> or include <queue>

with the file being under this directory which is also part of my project.

when I compile I get an error message

math.h resides in the same directory, and I don't have any issues when I do #includ <math.h>

  • William,

    Moved this thread to compiler team from C2000 team

    Regards,
    Manoj
  • Recent versions of the C2000 compiler do supply the standard C++ header file <queue> .  Something is wrong with your forum post.  I cannot see the compiler diagnostics.  Instead of screen shots, please copy-n-paste the full text of the diagnostics from the Console (not Problems) view.

    Thanks and regards,

    -George

  • "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_c_features.h", line 439: warning #48-D: incompatible redefinition of macro "_STLP_VENDOR_CSTD" (declared at line 112 of "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_c__ti.h")
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 103: error #149: declaration is incompatible with builtin "int abs(int)" (declared at line 119 of "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/stdlib.h")

    there are a lot more errors reported, but that's due to the #include <queue> not working I suppose.

    I cant even do a work around by implementing a queue class because I have to #include <cstdlib> for that,
    and that generates a similar error.
  • "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_c_features.h", line 439: warning #48-D: incompatible redefinition of macro "_STLP_VENDOR_CSTD" (declared at line 112 of "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_c__ti.h")
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 103: error #149: declaration is incompatible with builtin "int abs(int)" (declared at line 119 of "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/stdlib.h")
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 103: error #29: expected an expression
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 111: error #41: expected an identifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 111: error #29: expected an expression
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 125: error #249: function "abs" has already been defined
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 125: error #29: expected an expression
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 126: error #41: expected an identifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s__cstdlib.h", line 126: error #29: expected an expression
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 41: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 41: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 45: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 45: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 48: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 48: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 52: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 52: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 55: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 55: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 58: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 58: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 62: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 62: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 65: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 65: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 69: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 69: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 72: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 72: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 76: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 76: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 79: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 79: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 83: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 83: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 86: warning #78-D: this declaration has no storage class or type specifier
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 86: error #66: expected a ";"
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/include/s_type_manips.h", line 90: warning #78-D: this declaration has no storage class or type specifier

    the list goes on
  • I am unable to reproduce the same behavior.  Please show me the compiler build options.  Just like with the error messages, copy-n-paste from the Console view the entire invocation of the compiler shell cl2000.

    Thanks and regards,

    -George

  • I think I figured it out.  Did you #include <queue> in a source file with the extension .c?  Like, my_source_file.c?  The compiler presumes this file is C source, and not C++ source.  It is not valid to include a C++ header file in C source.  You probably need to change the file extension to .cpp, like my_source_file.cpp.

    Thanks and regards,

    -George

  • You are correct, by changing the extension to .cpp the error no longer is reported on the #include<queue> however, it seems that when I change the extension to .cpp is conflicts with my other header files (or maybe .c and .cpp mix is causing an issue). 

    "C:/ti/motorware/motorware_1_01_00_18/sw/modules/angle_gen/src/32b/angle_gen.h", line 92: error #20: identifier "labs" is undefined

    "C:/ti/motorware/motorware_1_01_00_18/sw/modules/datalog/src/32b/datalog.h", line 137: warning #262-D: explicit type is missing ("int" assumed)

    "C:/ti/motorware/motorware_1_01_00_18/sw/modules/datalog/src/32b/datalog.h", line 165: warning #994-D: missing return statement at end of non-void function "DATALOG_update"

    "C:/ti/motorware/motorware_1_01_00_18/sw/modules/ctrl/src/32b/ctrlQEP.h", line 1862: error #20: identifier "labs" is undefined

    "C:/ti/motorware/motorware_1_01_00_18/sw/modules/ctrl/src/32b/ctrlQEP.h", line 2027: error #20: identifier "labs" is undefined

    "../main.cpp", line 157: warning #48-D: incompatible redefinition of macro "FLASH"

    "../main.cpp", line 205: error #351: no operator "=" matches these operands

     

    do you have any advice on how to resovle this? any advice is fine

  • I am not familiar with Motorware.  It seems likely it is not documented or tested to work with C++.  You could try wrapping the header files with extern "C", like this ...

    extern "C" {
    /* #include motorware header files here */
    }

    I suspect that will help, but it won't fix all the problems.

    For background on why this helps, and other related ideas on mixing C and C++, please see this FAQ (not from TI).

    Thanks and regards,

    -George