"String Could Not Resolved" Error in Eclipse for C++ (Eclipse Can't Resolve Standard Library)

string could not resolved error in Eclipse for C++ (Eclipse can't resolve standard library)

The problem was that I needed to have both minGW and MSYS installed and added to PATH.

The problem is now fixed.

std::string could not be resolved in eclipse ubuntu

I solved the issue and it was not that trivial as I thought.

Since i created a new project from an existing project, then it just didn't add anything to the include directories. Linux/Eclipse is so messed up that it can't even add folders recursively?

I just created a new empty project and copied what I needed and was done with it.

Unresolved inclusion error with Eclipse CDT for C standard library headers

The compiler Eclipse is using is able to resolve the symbols just fine, so the code will compile fine.

But the code-completion/indexer or preprocessor Eclipse is using doesn't know where stdio.h exists.

You need to specify the filesystem path where stdio.h is located.

The Eclipse documentation describes this in several sections for the compiler:

  • Adding include paths and symbols
  • C/C++ Project Properties, Paths and Symbols, Includes

And if the code-completion/indexer or preprocessor specifically also cannot locate stdio.h:

  • Setting up include paths and macros for C/C++ indexer
  • C/C++ Project properties: Preprocessor Include Paths, Macros, etc.

The exact location of stdio.h will depend on the system you are intending to write the code for. If you are writing code for the same system you are running Eclipse on, then the standard location is /usr/include/stdio.h for Linux, macOS, Cygwin, etc.

If you are cross-compiling for a separate/remote target system (e.g. Android, Raspberry Pi, STM32), then it will be located somewhere in the SDK you installed for that system. You will need to refer to that particular SDK documentation.

Eclipse CDT: Symbol 'cout' could not be resolved

Most likely you have some system-specific include directories missing in your settings which makes it impossible for indexer to correctly parse iostream, thus the errors. Selecting Index -> Search For Unresolved Includes in the context menu of the project will give you the list of unresolved includes which you can search in /usr/include and add containing directories to C++ Include Paths and Symbols in Project Properties.

On my system I had to add /usr/include/c++/4.6/x86_64-linux-gnu for bits/c++config.h to be resolved and a few more directories.

Don't forget to rebuild the index (Index -> Rebuild) after adding include directories.

Multiple could not be resolved problems using Eclipse with minGW

Go to Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros, etc. -> Providers -> CDT GCC built-in compiler settings, deactivate Use global provider shared between projects and add the command line argument -std=c++11.

The eclipse live code analysis does not share the same settings with the build compiler. You can also change the setting globally (not just for the project) in Window -> Preferences -> C/C++ -> Build -> Settings -> CDT GCC Built-in Compiler Settings.

Edit: You need to #include <string> to use std::to_string.



Related Topics



Leave a reply



Submit