Fixing 'Eclipse Symbol std Could Not Be Resolved' Error.

Overview

In Eclipse, the Error: Symbol 'std' could not be resolved may be displayed when writing C++ code. This error occurs when compiler settings are incorrect and Eclipse could not find the standard C/C++ library. This documentation provides helpful advice and step-by-step instructions for resolving this error.

Symptoms

When this error is displayed, the source code may be highlighted in yellow with a small error indicator icon in the left margin. Hovering over the icon reveals the error message Symbol 'std' could not be resolved. Additionally, any reference to a standard library object, such as cin, cout, etc., may also be highlighted in yellow and display the same error message.

Causes

This error occurs when the C/C++ library configuration for the project is incorrect.

Solution

Step 1.

Right-click on the project, and select Properties from the list of options.

Step 2.

Navigate to C/C++ Build > Settings > Tool Settings on the  Project Properties window.

Step 3.

Under GCC C++ Compiler > Includes, click Add....

Step 4.

Add the include path of the standard C or C++ library, depending on the type of code you are working with.

The recommended include path for the GNU C++ Library is /usr/include/c++/9.3.0.

Step 5.

Select Apply and Close and then Build Project the project. This should result in the error being resolved and the highlights removed from the code.

FAQ

Q: What's causing this error?

A: This error occurs due to incorrect compiler settings, specifically the lack of the standard C/C++ library path.

Q: How do I know if I'm using C or C++?

A: The distinction between C and C++ is based on the file extensions used. A file with the .cpp extension indicates that the code is using the C++ compiler. A .c extension indicates that the code is using the C compiler.

Q: What if I don't want to include the C/C++ library?

A: The C/C++ library should be included, as it contains a number of functions and objects that are used in the code. Without it, the symbols cannot be properly resolved.

Further Reading

Eclipse Wiki: Symbol 'std' could not be resolved

Stack Overflow Question: 'std' could not be resolved in Eclipse

Eclipse Forums: Symbol 'std' could not be resolved ?

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Lxadm.com.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.