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.

CC3235SF: Why is CCS/Eclipse unable to see the C++ standard header files?

Part Number: CC3235SF

I'm currently making a C++ project and have all of my application libraries built and working, no issues there.  However, I've found that the indexer does not appear to be aware of any C++ header files, which manifests in at least three different ways:

  • If I type "#include <alg" and try to autocomplete (Ctrl-Space), I get an error bong.  I would expect it to autocomplete "#include <algorithm>".  Autocomplete works fine for regular C headers.
  • If I have a class member, say, "std::string my_string", and I type "(dot)" to access the class members and methods, I get a pop-up list of available class members and their types.  But for my example, I would see "my_string : ?" because the indexer doesn't know that "std::string" is a type.
  • If I were to then type "my_string." (note the dot), the IDE does nothing, when it should be popping up a list of std::string class members and methods.

Basically, the IDE isn't being told where the C++ standard headers are located, so it can't assist with any C++ standard library content, which is a big hassle.  I drilled into the project settings (my base project was based on the SDK "local_time" example), and I came upon this:

From there you can see all the possible locations where it's pulling in header files.  One location that is not being included is the C++ header file directory (.../arm-none-eabi/include/c++/9.2.1).  So, I tried to fix this issue myself by adding it to the include directories, like so:

This does cause the full path (C:\TI\ccs_10.2.0\ccs\tools\compiler\gcc-arm-none-eabi-9-2019-q4-major\arm-none-eabi\include\c++\9.2.1) to appear in the preprocessor paths dialog below the two for C headers.  But even after a full index rebuild, and re-resolving includes, I still can't get the IDE to figure out what a string is:

So... what gives?  What's the correct way to tell the IDE where the C++ header files are?  C++ editing works great in NXP MCUXpresso, so I know Eclipse is perfectly capable of doing this.  (Using CCS 10.2.0 presently.)  Thanks.

  • Not sure why this posted to the Wi-Fi forum, but whatever...

  • Hi DR216,

    We'll look into this and get back to you shortly.

    BR,

    Seong

  • Hello

    If I type "#include <alg" and try to autocomplete (Ctrl-Space), I get an error bong.  I would expect it to autocomplete "#include <algorithm>".  Autocomplete works fine for regular C headers.
    From there you can see all the possible locations where it's pulling in header files.  One location that is not being included is the C++ header file directory (.../arm-none-eabi/include/c++/9.2.1).  So, I tried to fix this issue myself by adding it to the include directories, like so:

    Thant should be all you need. The added include search path should appear in the "includes' node and content should get indexed, This worked for me in CCS 10.2.0:

    Does the include path for the C++ header files correctly appear for the file in the Project Explorer view? If it does, but the index is not working, can you try cleaning your workspace?

    Thanks

    ki

  • I do see the ".../include/c++/9.2.1" path appear in my includes.  And I can now autocomplete "#include <algorithm>".  However, I still cannot do autocomplete/content assist for the std::string class (which is what made me first notice the C++ include issues).

    This is my existing project, and I just created a new source file.  I've got #include <string> in there.  If I F3 <string>, the IDE opens "string" (the header file).  And from there I can also use F3 to open "bits/basic_string.h".  So the IDE at least seems to know where the header files are.  BUT... look at what I'm doing up there... I just typed "std::" and got the content assist window, which I've expanded.  And the "string" type is nowhere to be seen.  And I've already declared "std::string wibble;" -- if on the next line I type "wibble.", I get no content assist, when I should get a whole list of std::string methods.  And std::string usually appears green in Eclipse as a recognized type, but it's just black here.

    (FWIW, I did nuke my workspace settings and re-imported my three projects; the two that include C++ objects do have the C++ include headers in the list of include directories.)

    Can you try to reproduce this specific case (unable to get content assist on std::string)?  Any idea what I'm doing wrong here?

  • Interesting, it seems to be specific to when I use the GCC compiler. When I use the TI compiler, it seems to behave as expected. I will need to investigate further

  • Reassuring that you're able to reproduce my issue.  Will wait to hear back, thanks.

  • It is an odd issue. I tried various suggestions found on Eclipse forums but no dice. I also reproduced with the 7.2.1 compiler that ships with CCS 10.2.0. Surprised that it would be a CCS specific issue. You mentioned you are using another Eclipse based IDE that does not have any issue with this. Do you know what Eclipse and CDT version is used in that IDE?

    Thanks

    ki

  • Here's the link to NXP's release notes for MCUX.  Here's all the mentions I could find of what specific Eclipse + CDT versions they used:

    • MCUX 11.3.0 (Jan 2021) - Upgraded: Eclipse version to 2020.06 (Eclipse Platform 4.16.0 / CDT9.11.1).
    • MCUX 11.2.0 (July 2020) - Upgraded: Eclipse version to 2019.12 (Eclipse Platform 4.14.0 / CDT9.10.0).
    • MCUX 11.1.0 (Dec 2019) - Upgraded underlying Eclipse Framework to 4.12.0.v201906 / CDT9.8.1
    • MCUX 11.0.0 (Jun 2019) - Upgraded underlying Eclipse Framework to 4.10.0v201812 / CDT 9.6.0.
    • MCUX 10.2.0 (May 2018) - Upgraded Eclipse to Oxygen.3a / CDT 9.4.3.

    I've been using MCUX for 5+ years for C++ development on Cortex-M and have never encountered issues with Eclipse not knowing STL types.  I've developed with CCS v9/v10 previously, but this is my first C++ project with CCS.  Is there some preprocessor define that GCC is expecting the IDE to emit, and if it doesn't, the IDE can't see the STL definitions?  It's not just std::string, it doesn't know what std::array is, even though the code compiles fine.

  • CCS 10.2.0 should be based off Eclipse 4.14 and CDT 9.1.0 (same as MCUX 11.2.0). Yes it is likely just some configuration that is missing in CCS. I will need to escalate this to the IDE engineers. I will keep you posted of any updates.

    Thanks

    ki

  • I filed a bug for this. Tracking link is: https://sir.ext.ti.com/jira/browse/EXT_EP-10335

    Thanks

    ki

  • Thanks, I'll watch that for updates.