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.

cpp string in Code Composer v2.20.00



Hello,

I am trying to run a simple C++ project in code composer. For legacy issues I am only able to use CCS v2. I am trying to compile the following cpp source file:

#include <stdio.h>
#include <string.h>

class myClass{

};

int main(){

string myString;

return 0;

}

I am getting the following error:

------------------------------  Test.pjt - Debug  ------------------------------
"c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"c:/documents and settings/all users/desktop/Test/Debug" -d"_DEBUG" -mv6700 -@"../../all users/desktop/Test/Debug.lkf" "main.cpp"
"main.cpp", line 11: error: identifier "string" is undefined
"main.cpp", line 11: warning: variable "myString" was declared but never referenced
1 error detected in the compilation of "main.cpp".

Build Complete,
  1 Errors, 1 Warnings, 0 Remarks.

---------------------------------------------

if I change the line:

std::string myString;

I get:

------------------------------  Test.pjt - Debug  ------------------------------
"c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"c:/documents and settings/all users/desktop/Test/Debug" -d"_DEBUG" -mv6700 -@"../../all users/desktop/Test/Debug.lkf" "main.cpp"
"main.cpp", line 11: error: namespace "std" has no member "string"
"main.cpp", line 11: warning: variable "myString" was declared but never referenced
1 error detected in the compilation of "main.cpp".

Build Complete,
  1 Errors, 1 Warnings, 0 Remarks.

---------------------------

Any help would be greatly appreciated.

Regards,

Bruno

  • Try:

    #include <stdio.h>
    #include <string>
    
    class myClass{
    
    };
    
    int main(){
    
    std::string myString;
    
    return 0;
    
    }
  • Thanks for the quick reply. When I run your code i get:

    ------------------------------  Test.pjt - Debug  ------------------------------
    "c:\ti\c6000\cgtools\bin\cl6x" -g -q -fr"c:/documents and settings/all users/desktop/Test/Debug" -d"_DEBUG" -mv6700 -@"../../All Users/Desktop/Test/Debug.lkf" "main.cpp"
    "main.cpp", line 11: error: namespace "std" has no member "string"
    "main.cpp", line 11: warning: variable "myString" was declared but never referenced
    1 error detected in the compilation of "main.cpp".

    Build Complete,
      1 Errors, 1 Warnings, 0 Remarks.

    When I print the File dependencies I get:

    main.cpp ( C:\Documents and Settings\SSL.Admin.SPHERES-LAB\Desktop\main.cpp )
         Line 0002: stdio.h ( C:\ti\c6000\cgtools\include\stdio.h )
         Line 0003: string ( WARNING, File not found! )

    I went to the directory C:\ti\c6000\cgtools\include\ and confirmed it is missing. I found cstring so I tried including cstring instead but still getting the same error. Is there any reason why the string lib is missing or something I need to install?

    Thank you, Bruno

  • Old versions of the compiler don't support the C++ template functions, such as string.  What version of the compiler are you using (it's not the same as the CCS version).

  • I run the cl6x -versions command in the c/ti/c6000/cgtools/bin and I got


    TMS320C6x C/C++ Compiler         Version 4.32
    Tools Copyright (c) 1996-2002    Texas Instruments Incorporated

    TMS320C6x C/C++ Parser           Version 4.32
    TMS320C6x C/C++ File Merge       Version 4.32
    TMS320C6x C/C++ Optimizer        Version 4.32
    TMS320C6x C/C++ Codegen          Version 4.32
    TMS320C6x Consultant Information Version 4.32
    TMS320C6x Assembly Preprocessor  Version 4.32
    TMS320C6x COFF Assembler         Version 4.32
    TMS320C6x C Source Interlister   Version 4.32
    TMS320C6x COFF Linker            Version 4.32
    TMS320C6x Absolute Lister        Version 4.32

  • Oh wow.  That compiler is at least 10 years old.  Maybe 15 years old.  Our support for C++ was lacking back then.  I would tell you to upgrade the compiler, but that new compiler may not work well with a very old version of CCS.  

    Consider this suggestion ... Upgrade the compiler, but do the builds from the command line outside CCS.  You can still use CCS to load and debug.  Is this practical?

    Thanks and regards,

    -George