Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Editor underlines string_view as error
Editor underlines string_view as error [message #1842126] Wed, 09 June 2021 17:21 Go to next message
Ivan Skriabin is currently offline Ivan SkriabinFriend
Messages: 1
Registered: June 2021
Junior Member
Please, help.
Editor underlines string_view as error: "Type 'string_view' could not be resolved"
The <string_view> is included. In Properties/C/C++ Build/Settings/Dialect c++17 is chosen.
When I build project there are no errors in console, but there is an error in editor. Program is working, but editor's bug irritates me.
  • Attachment: error.png
    (Size: 173.42KB, Downloaded 149 times)
Re: Editor underlines string_view as error [message #1842144 is a reply to message #1842126] Thu, 10 June 2021 08:26 Go to previous message
David VavraFriend
Messages: 1430
Registered: October 2012
Senior Member
Properties --> C/C++ Build --> Settings are only used for building Makefiles in a Managed Build project.
In fact, they are only present in such a project.
You also need to change the the builtin provider command to alert the Indexer.

The default standard for GCC depends on the GCC version.
Some (mine for instance, 9.3.1 20200408) default to c++14
Here's the latest from GNU:
Says 2014 C++ standard is the default from GCC 6.1 up through GCC 10.

Add -std=c++17 to the provider command at
Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Providers tab
${COMMAND} -std=c++17 ${FLAGS} -E -P -v -dD "${INPUTS}"

The provider doesn't always run right away.
May not take effect until the next build.
Forcing a console to be allocated to it sometimes causes it to run.
You may still need to rebuild the index.

The value for __cplusplus should be greater than or equal to 201703L.
You could also add it to the User Settings Entries on the Entries tab.


Please don't embed such large images.
The web software use by Eclipse doesn't handle it well.
Smaller screens may not get a horizontal scroll bar.
And even when they do, it forces constant scrolling to read the post.
It's one of the reasons why I put sentences on separate lines.

[Updated on: Thu, 10 June 2021 09:13]

Report message to a moderator

Previous Topic:How to change CDT builder to CMake in existing project?
Next Topic:Inconsistent behavior for "drag and drop"
Goto Forum:

Current Time: Sun Jul 03 03:36:34 GMT 2022

Powered by FUDForum. Page generated in 0.02109 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top