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.

Compiler/TMS570LS3137: TI v18.1.2.LTS compiler error when including <string> (C++)

Part Number: TMS570LS3137


Tool/software: TI C/C++ Compiler

When I include <string> (or any header that uses string, like <iostream>) in my project I get the error message below. I don't have any issue with other STL headers such as <array> or <vector>. I've tried reinstalling the code generation tools, but that didn't fix anything.

>> Compilation failure
source/subdir_rules.mk:163: recipe for target 'source/sys_main.obj' failed
"C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include/libcxx/__string", line 269: error #121: return value type does not match the function type
"C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include/libcxx/__string", line 375: error #121: return value type does not match the function type

Here are the referenced lines in the library from the compiler:

inline _LIBCPP_CONSTEXPR_AFTER_CXX14
const char*
char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
{
    if (__n == 0)
        return NULL; //LINE 269
#if __has_feature(cxx_constexpr_string_builtins)
    return __builtin_char_memchr(__s, to_int_type(__a), __n);
#elif _LIBCPP_STD_VER <= 14
    return (const char_type*) memchr(__s, to_int_type(__a), __n);
#else
    for (; __n; --__n)
    {
        if (eq(*__s, __a))
            return __s;
        ++__s;
    }
    return NULL;
#endif
}

...

inline _LIBCPP_CONSTEXPR_AFTER_CXX14
const wchar_t*
char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
{
    if (__n == 0)
        return NULL; //LINE 375
#if __has_feature(cxx_constexpr_string_builtins)
        return __builtin_wmemchr(__s, __a, __n);
#elif _LIBCPP_STD_VER <= 14
    return wmemchr(__s, __a, __n);
#else
    for (; __n; --__n)
    {
        if (eq(*__s, __a))
            return __s;
        ++__s;
    }
    return NULL;
#endif
}

Thank you for your help.

  • To understand what happened, we need more information.  For the source file sys_main.cpp, please send in a test case as described in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Hi George,

    Here is the requested pre-processed file

    sys_main.txt

    Console Log:


    **** Build of configuration Debug for project VehicleDataLogger_cpp ****

    "C:\\ti\\ccsv8\\utils\\bin\\gmake" -k -j 8 all -O

    Building file: "../source/sys_main.cpp"
    Invoking: ARM Compiler
    "C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/bin/armcl" -mv7R4 --code_state=32 --float_support=VFPv3D16 -Ooff --opt_for_speed=1 --include_path="C:/Users/nz6w7j/git/VehicleDataLogger_cpp/VehicleDataLogger_cpp" --include_path="C:/Users/nz6w7j/git/VehicleDataLogger_cpp/VehicleDataLogger_cpp/abstract" --include_path="C:/Users/nz6w7j/git/VehicleDataLogger_cpp/VehicleDataLogger_cpp/fatfs/source" --include_path="C:/Users/nz6w7j/git/VehicleDataLogger_cpp/VehicleDataLogger_cpp/fatfs/port" --include_path="C:/Users/nz6w7j/git/VehicleDataLogger_cpp/VehicleDataLogger_cpp/cpp_driver_wrappers" --include_path="C:/Users/nz6w7j/git/VehicleDataLogger_cpp/VehicleDataLogger_cpp/include" --include_path="C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include" -g --preproc_only --preproc_with_compile --diag_warning=225 --diag_wrap=off --display_error_number --enum_type=packed --abi=eabi --obj_directory="source" "../source/sys_main.cpp"

    >> Compilation failure
    source/subdir_rules.mk:163: recipe for target 'source/sys_main.obj' failed
    "C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include/libcxx/__string", line 269: error #121: return value type does not match the function type
    "C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include/libcxx/__string", line 375: error #121: return value type does not match the function type
    2 errors detected in the compilation of "../source/sys_main.cpp".
    gmake: *** [source/sys_main.obj] Error 1
    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****

  • Thank you for submitting the test case.  I can reproduce the problem.  I filed CODEGEN-5033 in the SDOWP system to have this investigated.  You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George

  • For anyone else having this issue, changing all four occurrences of "NULL" to "nullptr" in "/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include/libcxx/__string" seems to work as a temporary fix.